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
@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

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