Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ QRCode API #148

Merged
merged 29 commits into from
Oct 10, 2024
Merged

✨ QRCode API #148

merged 29 commits into from
Oct 10, 2024

Conversation

rezk2ll
Copy link
Member

@rezk2ll rezk2ll commented Sep 27, 2024

feature

  • requests a new access_token using SSO and matrix
  • generates an SVG image containing the access_token and a magic link to the mobile application.

Prerequisites

the user must be connected
the web auth cookie must be included in the request: ie lemonldap

example:

twake.chat://login?access_token=123456

closes linagora/twake-on-matrix#1764

demo

API using Postman

qrcode

qrcode decode using mobile ( without mobile magic link )

Screenrecorder-2024-10-08-11-55-51-892.mp4

@rezk2ll rezk2ll changed the title Qr code api ✨ QRCode API Sep 27, 2024
@rezk2ll rezk2ll requested a review from guimard September 27, 2024 15:28
@guimard
Copy link
Member

guimard commented Sep 27, 2024

Hi @rezk2ll : which access_token do you display here ? Remember that an access token owns to only one device

@rezk2ll rezk2ll marked this pull request as ready for review October 7, 2024 07:49
@rezk2ll rezk2ll marked this pull request as draft October 7, 2024 11:51
@rezk2ll rezk2ll changed the title ✨ QRCode API ✨ [DRAFT] QRCode API Oct 7, 2024
@rezk2ll rezk2ll marked this pull request as ready for review October 8, 2024 10:02
@rezk2ll rezk2ll changed the title ✨ [DRAFT] QRCode API ✨ QRCode API Oct 8, 2024
@rezk2ll rezk2ll merged commit 3ca01a9 into linagora:master Oct 10, 2024
9 checks passed
@hoangdat
Copy link
Member

hi @rezk2ll , what kind of token in QR code?

@hoangdat
Copy link
Member

hi @rezk2ll , we want to generate QR code ourselves. Which endpoint we need to use?

@rezk2ll
Copy link
Member Author

rezk2ll commented Oct 23, 2024

hi @rezk2ll , we want to generate QR code ourselves. Which endpoint we need to use?

Hello @hoangdat ,

the endpoint is /_twake/v1/qrcode

More details on the swagger docs here
https://linagora.github.io/ToM-server/#/QR%20Code/get__twake_v1_qrcode

It requires the lemonldap cookie to be present in the request.

The endpoint is available in staging

@rezk2ll
Copy link
Member Author

rezk2ll commented Oct 23, 2024

hi @rezk2ll , what kind of token in QR code?

it is an access_token obtained from matrix using the /_matrix/client/v3/login endpoint

@hoangdat
Copy link
Member

the endpoint is /_twake/v1/qrcode

But we only need the token, we want to generate our QR code from our self, to put it to our component view

@rezk2ll
Copy link
Member Author

rezk2ll commented Oct 23, 2024

the endpoint is /_twake/v1/qrcode

But we only need the token, we want to generate our QR code from our self, to put it to our component view

The endpoint returns a ready SVG image that can be rendered freely on the front end.

do you want an endpoint to return only a new access_token?

like /_twake/v1/access_token ?

@hoangdat
Copy link
Member

hoangdat commented Oct 24, 2024

hi @guimard , what do you think it is security issue if access_token stay in QR code?
From my point of view, any scanner can scan it and extract it, it is a huge risk.

@guimard
Copy link
Member

guimard commented Oct 24, 2024

Hi, there is a risk when QR code is displayed.
The best would be to follow Whatsapp way : the QR code has to be scanned from a valid device to validate new device but it's harder to build

rezk2ll added a commit that referenced this pull request Dec 13, 2024
commit 943a592
Author: Khaled Ferjani <kferjani@linagora.com>
Date:   Thu Dec 12 09:29:26 2024 +0100

    🐛 fix monthly and weekly new users not being calculated correctly (#152)

    * 🐛 fix: monthly and weekly new users not being calculated correctly

    * 🧪 chore: fix tests

    * 🏷️ chore: fix types

    * 🧪 chore: fix controller unit test

    * 🧪 chore: fix tests

    * 🧪 chore: fix tests

commit 4c8e9b9
Author: Khaled Ferjani <kferjani@linagora.com>
Date:   Wed Dec 11 14:12:15 2024 +0100

    🐛 fix last_seen calculation is metrics API (#151)

    * 🎨 feat: added user_ips table to collection types

    * 🐛 fix: user last_seen field calculation

    * 🏷️ chore: added matrix user ip info type

    * 🧪 chore: fix tests

commit 0c8a035
Author: Khaled Ferjani <kferjani@linagora.com>
Date:   Wed Dec 11 11:20:02 2024 +0100

    🐛 fix(metrics API): remove unexistant fields in users table (#150)

commit 7dce966
Author: Khaled Ferjani <kferjani@linagora.com>
Date:   Tue Dec 10 17:01:37 2024 +0100

    ✨ Metrics API (#149)

    * ✨ feat: added metrics service

    * ✨ feat: added metrics API controller

    * ✨ feat: added metrics API middleware

    * ✨ feat: added metrics API routes

    * 🏷️ chore: added metrics API related types

    * 🎨 chore: added events table to MatrixDB collections

    * 🎨 chore: export metrics API

    * 🎨 feat: integrate matrics API routes to main app

    * 🚨 chore: lint

    * 🧪 chore: added controller tests

    * 🧪 chore: added middleware test

    * 🧪 chore: added route test

    * 🧪 chore: added metrics service test

    * 🐛 fix: swagger openapi docs

    * 📝 chore: generate swagger docs

commit 3ca01a9
Author: Khaled Ferjani <kferjani@linagora.com>
Date:   Thu Oct 10 13:51:11 2024 +0200

    ✨ QRCode API (#148)

    * ✨ feat: added QRCode service

    * ✨ feat: added QRCode API controller

    * ✨ feat: added QRCode API Router

    * 🏷️ chore: add QRCode API types

    * ✨ feat: added QRCode API

    * ➕ chore(deps): added qrcode deps

    * ✅ chore: add unit tests

    * 🏷️ chore: added qr_code_url to the config

    * ✨ feat: use a QRCode url config

    * ✅ chore: update unit tests

    * 📝 chore: update swagger docs

    * 🔧 chore: add qr_code_url to default config

    * 🧪 chore: update test config

    * ✨ feat: added qrcode token service

    * ✨ feat: added qrcode service

    * 🎨 chore: expose services

    * 🎨 feat: use exposes services

    * 🏷️ chore: update qrcode API related types

    * ✅ chore: add service tests

    * 🧪 chore: update controller tests

    * 🔇 chore: remove console log

    * 🏷️ chore: add oidc flow related types

    * ✨ feat: fetch access_token using OIDC

    * 🎨 feat: use cookies to start the oidc flow

    * 🐛 fix: Dockerfile QR CODE env variable init

    * ✨ feat: use OIDC flow to request a new access_token

    * 🧪 chore: update token service unit tests

    * 🏷️ chore: add oidc flow related types

    * 🧪 chore: update controllers unit test

commit 30c9591
Author: Yadd <yadd@debian.org>
Date:   Thu Jul 18 10:38:31 2024 +0400

    Don't build matrix invite for arm

commit da06543
Author: Yadd <yadd@debian.org>
Date:   Thu Jul 18 09:40:40 2024 +0400

    Reduce architecture list

commit 175cd1a
Author: Yadd <yadd@debian.org>
Date:   Thu Jul 18 09:40:14 2024 +0400

    Fix matrix-invite build

commit 0e6b793
Author: Yadd <yadd@debian.org>
Date:   Thu Jul 18 08:23:36 2024 +0400

    Switch to docker/build-push-action@v4

commit b5627bd
Author: Yadd <yadd@debian.org>
Date:   Thu Jul 18 08:18:20 2024 +0400

    Switch to docker/build-push-action@v4

commit 2ac672d
Author: Yadd <yadd@debian.org>
Date:   Thu Jul 18 08:04:05 2024 +0400

    Publish on ARM also

commit b544a90
Author: Yadd <yadd@debian.org>
Date:   Thu Jul 18 07:23:52 2024 +0400

    Drop nx cache during docker build

commit 034db33
Author: Yadd <yadd@debian.org>
Date:   Thu Jul 18 06:19:50 2024 +0400

    Merge full-id-service

commit 964e22d
Merge: c7d605c 4cb056a
Author: Yadd <yadd@debian.org>
Date:   Mon Jul 15 13:07:01 2024 +0400

    Merge pull request #41 from artembru/patch-1

    Update README.md

commit 4cb056a
Merge: 6982d7d c7d605c
Author: Yadd <yadd@debian.org>
Date:   Mon Jul 15 13:06:31 2024 +0400

    Merge branch 'master' into patch-1

commit c7d605c
Merge: b38abac dd7727f
Author: Yadd <yadd@debian.org>
Date:   Fri Jul 12 20:13:59 2024 +0400

    Merge pull request #112 from rezk2ll/#99-update

    🎨 added update recovery words route (#99)

commit dd7727f
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Fri Jul 12 12:40:28 2024 +0100

    🧪 chore: fix tests

commit 1889bbb
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Fri Jul 12 11:50:41 2024 +0100

    🧪 chore: update tests

commit 51a899a
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Fri Jul 12 11:43:15 2024 +0100

    🐛 fix: place data check inside try block

commit 308df16
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Fri Jul 12 11:41:30 2024 +0100

    📝 chore: update swagger docs

commit 32eb5ff
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Fri Jul 12 11:35:33 2024 +0100

    📝 feat: added update recovery words route and openapi docs

commit ad7c03a
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Fri Jul 12 11:30:55 2024 +0100

    🧪 chore: update tests

commit b9e39b7
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Fri Jul 12 11:30:43 2024 +0100

    🎨 fix: prevent recovery words creation when the user already has one

commit b38abac
Author: Khaled Ferjani <kferjani@linagora.com>
Date:   Tue Jul 9 15:08:42 2024 +0100

    🐛 fix: update existing active contacts (#104)

    * 🐛 fix: update existing active contacts

    * 🧪 chore: update tests

commit 7037b9f
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Tue Jul 9 14:24:22 2024 +0100

    🎨 chore: fix typo in success message

commit 54d0c54
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Tue Jul 9 14:09:43 2024 +0100

    🧪 chore: update tests

commit e6f08ac
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Tue Jul 9 14:09:29 2024 +0100

    🐛 fix: update existing recovery words

commit 3af3865
Merge: 6b83164 f36b4a9
Author: Yadd <yadd@debian.org>
Date:   Tue Jul 9 06:16:01 2024 +0400

    Merge pull request #95 from rezk2ll/active-contacts

    ✨ added active contacts API

commit f36b4a9
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 22:37:17 2024 +0100

    🗃️ chore: added activeContacts table schema

commit 4161d4f
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 19:54:31 2024 +0100

    👷 chore: generate swagger docs

commit ec965e0
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 19:53:49 2024 +0100

    📝 feat: added swagger docs

commit b09d36e
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 19:12:44 2024 +0100

    ✅ chore: fixed route tests

commit 1da7ee2
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 19:11:58 2024 +0100

    🎨 chore(service): fixed a typo in table name

commit 383d1a6
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 19:11:19 2024 +0100

    🧪 chore: add service tests

commit ba4d546
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 14:20:28 2024 +0100

    🎨 feat: expose active contacts API

commit 8e1b5f2
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 14:18:35 2024 +0100

    🧪 feat: added tests

commit 3ae2fcd
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 14:18:25 2024 +0100

    🎨 chore: export active contacts API

commit d15d4b2
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 14:17:47 2024 +0100

    🏷️ chore: added active contacts related types

commit d209bbb
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 14:17:26 2024 +0100

    ✨ feat: added active contacts route

commit 54c1f98
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 14:17:10 2024 +0100

    ✨ feat: added active contacts middleware

commit b525758
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 14:16:52 2024 +0100

    ✨ feat: added active contacts controller

commit 142dd95
Author: Khaled FERJANI <kferjani@linagora.com>
Date:   Mon Jul 8 14:16:31 2024 +0100

    ✨ feat: added active contacts service

commit 6982d7d
Author: artembru <146178981+artembru@users.noreply.github.com>
Date:   Thu Jul 4 16:18:24 2024 +0200

    Update README.md

    Deleted website URL

commit 3385816
Author: artembru <146178981+artembru@users.noreply.github.com>
Date:   Tue Jun 25 11:32:54 2024 +0200

    Update README.md

commit 6b83164
Merge: 3ce8304 3d6e44b
Author: Yadd <yadd@debian.org>
Date:   Mon Jun 24 09:28:47 2024 +0400

    Merge pull request #59 from linagora/drop-console-during-test

    Hide console debug during test

commit 3d6e44b
Author: Yadd <yadd@debian.org>
Date:   Thu Jun 20 06:48:06 2024 +0400

    Hide console debug during test

commit 3ce8304
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Jun 18 19:09:52 2024 +0000

    chore(deps-dev): bump ws in the npm_and_yarn group across 1 directory

    Bumps the npm_and_yarn group with 1 update in the / directory: [ws](https://github.com/websockets/ws).

    Updates `ws` from 7.5.9 to 7.5.10
    - [Release notes](https://github.com/websockets/ws/releases)
    - [Commits](websockets/ws@7.5.9...7.5.10)

    ---
    updated-dependencies:
    - dependency-name: ws
      dependency-type: indirect
      dependency-group: npm_and_yarn
    ...

    Signed-off-by: dependabot[bot] <support@github.com>

commit fcdd0b1
Author: artembru <146178981+artembru@users.noreply.github.com>
Date:   Thu Jun 6 17:00:13 2024 +0200

    Update README.md

    Updated background picture and links
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use QR code to signin in mobile app
3 participants