Back

BUG in createMagicURLSession.

  • 2
  • Flutter
  • Accounts
nithishjipmer
9 May, 2023, 14:42

Okkk

TL;DR
The user encountered a bug in the `createMagicURLSession` function and asked for clarification on using deep linking. The solution provided is to use deep linking to pass the deep link URL when calling `account.updateMagicURLSession()` in order to link to the app and retrieve the secret. They are directed to a GitHub issue for more information. The user is also discussing email logs and the format of the secret in the link. It is mentioned that when calling `createMagicURLSession`, it creates the token needed to log the user in, and `createMagicURLSession (confirm)` validates and creates the session for the user. The
nithishjipmer
9 May, 2023, 14:44

But createMahicUrlSession gets completed as soon as the mail is sent know?

safwan
9 May, 2023, 14:46

there's two endpoints:

createMagicUrlSession createMagicUrlSession (confirm)

safwan
9 May, 2023, 14:47

when you call createMagicUrlSession, it creates the token needed to log the user in. createMagicUrlSession (confirm) uses the token's content to validate and create the session for the user.

safwan
9 May, 2023, 14:49

Should I mark this as solved considering you made a new post?

nithishjipmer
9 May, 2023, 14:50

No no please wait

nithishjipmer
9 May, 2023, 14:51

If secret is made available by createMagicUrl then how does user clicking the link matter

Drake
9 May, 2023, 14:55

the secret is in the link.

Guille
9 May, 2023, 14:56

createMagicUrl seems to be sent the secret in the right format

Guille
9 May, 2023, 14:56
TypeScript
https://appwrite.open-clinics-cms.live/auth/magic-url?userId=645a4d8c5fa37a121285&secret=d2652e5b0eed1a7fdc8219a8617f206ede7b3a7acdb675277b5bb5703e0c532bb32edc26b28849837ba151ee8154df3d04f18734e30923de06ee6007b4793970ccc16ad278a5edf1bffaa90dedf314b9f923857cbe985f90f87b51d15e3d5ca1ffbb6927d11c94d86802767609c9a223f43eb275f7cfc89d05abe7d698ac6269&expire=2023-05-16+13%3A41%3A32.395&project=642d6c3be181312b0360
Guille
9 May, 2023, 14:56

this is what is sent checking your mail logs

nithishjipmer
9 May, 2023, 14:57

Yes

nithishjipmer
9 May, 2023, 14:57

I am getting the same in mail

Drake
9 May, 2023, 14:57
Guille
9 May, 2023, 14:57

Yes it was the flutter version and the appwrite version too

nithishjipmer
9 May, 2023, 14:58

How to access it inside app

nithishjipmer
9 May, 2023, 15:03

So whats the solution?

Drake
9 May, 2023, 15:04

For the moment, I recommend using deep linking (so you would pass your deep link URL when calling account.updateMagicURLSession()) to link to your app where you can grab the secret and call account.updateMagicURLSession().

nithishjipmer
9 May, 2023, 15:04

I should send the user to me website, and call updateMagicUrl there, then redirect him to app?

Drake
9 May, 2023, 15:05

your app needs to call the update magic url api

nithishjipmer
9 May, 2023, 15:06

How to access secret in app

nithishjipmer
9 May, 2023, 15:06

Sorry if i am dumb🥲

nithishjipmer
9 May, 2023, 15:08

Are you asking me to pass in a deeplink with createMagicUrl?

Drake
9 May, 2023, 15:23

Deeplinking is a way to make it so that when a user taps on a URL, instead of opening the website, they're sent into your app and all the query parameters of the URL are also sent into the app. Make sure to go through https://docs.flutter.dev/ui/navigation/deep-linking.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more