Back

[SOLVED] Flutter SDK - Phone Auth Issue

  • 1
  • Flutter
  • Accounts
awais2075
15 May, 2023, 06:11

I am using appwrite flutter sdk phone-auth secret generator function is working

but whenever I try to verify (phone-secret-verify function) it's giving invalid secret

whereas similar secret works via REST API

#flutter-sdk

TL;DR
User is experiencing an issue with phone authentication using the Flutter SDK. They are using the wrong function for updating the phone session and verification. They are also using the wrong token for OTP generation. The user is requesting code examples and assistance. The problem seems to be related to an invalid token. The error message they receive is "user_invalid_token, Invalid token passed in the request." They are using the Appwrite Flutter SDK. No solution is mentioned in the thread.
Vedsaga
15 May, 2023, 06:35

can you pls share the exact error you getting in the terminal

awais2075
15 May, 2023, 06:38

appwrite user_invalid_token, Invalid token passed in the request

Vedsaga
15 May, 2023, 08:33

this generally happens because token is invalid which can happen either because you are chaching the token and using it and while you trying to use the token that token is already expired get replaced with new

Vedsaga
15 May, 2023, 08:33

can you show the code which you are having

awais2075
15 May, 2023, 08:34

the problem is same token works via REST API

but not with flutter-sdk function

Vedsaga
15 May, 2023, 08:34

I mean are you trying to make request using token? because in the SDK you don't need to token to make request

Vedsaga
15 May, 2023, 08:38

if you can show the code of sdk that could be helpful

safwan
15 May, 2023, 08:48

@awais2075 can you share your code?

safwan
15 May, 2023, 08:49

specifically, share the functions for generating the token, then using that token in the confirmation

awais2075
16 May, 2023, 09:45
awais2075
16 May, 2023, 09:47

I am getting phone no. from user

then secret

and using token.userId on otp-gneration

awais2075
16 May, 2023, 10:20

I got it

I am using update-phone-verification

instead of update-phone-session

awais2075
16 May, 2023, 10:21

sequence should be

before login

create-phone-session update-phone-session

after login create-phone-verification update-phone-verification

safwan
17 May, 2023, 06:55

[SOLVED] Flutter SDK - Phone Auth Issue

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