Skip to content
Back

[SOLVED] Current User is Not authorized

  • 0
  • General
  • Flutter
  • Cloud
  • Auth
Arif Qayoom
13 Dec, 2024, 10:36

recreating same Thread

TL;DR
Developers faced an issue with authorization in their app, particularly related to user rights and providers. A solution was proposed to update providers correctly. The problem stemmed from conflicting clients within providers and the absence of passing clients to the account and database. The app only functioned properly after a restart and login. The advice included streamlining provider usage and ensuring a single client instance. Ultimately, the developers were encouraged to test potential fixes and share code snippets for better assistance. The issue was resolved by addressing client instantiation and passing it correctly within the application.
Arif Qayoom
13 Dec, 2024, 10:38
Arif Qayoom
13 Dec, 2024, 10:40

But if I restart the app & then login again My app is working Fine

D5
13 Dec, 2024, 10:41

What's the part?

Arif Qayoom
13 Dec, 2024, 10:42

Authentication Part!

Includes, Auth service, authprovider

D5
13 Dec, 2024, 10:43

Looks like your registering the user but not login it after registering.

D5
13 Dec, 2024, 10:43

Registration doesn't create a session by default

Arif Qayoom
13 Dec, 2024, 10:44

Yes the check the code after signup ... Again When I login This happens!

Arif Qayoom
13 Dec, 2024, 10:44

๐ŸคŒ

Darshan Pandya
13 Dec, 2024, 10:47

it'll be best if you add some related code snippets instead of the repo link. Its much more helpful to someone reading the thread for the first time.

Arif Qayoom
13 Dec, 2024, 10:47

But After Restarting the app... After login its working fine

D5
13 Dec, 2024, 10:47

Looks like you're not passing the client to the account and database

D5
13 Dec, 2024, 10:47

No idea. Could be that

Arif Qayoom
13 Dec, 2024, 10:48

let me try If I can forward the code

Arif Qayoom
13 Dec, 2024, 10:48

If you find some fix after reading the repo.. Plz help!

D5
13 Dec, 2024, 10:48

Where is the client method located at?

Arif Qayoom
13 Dec, 2024, 10:49

constants file๐Ÿ˜

D5
13 Dec, 2024, 10:50

But client .setEndpoint() .setProject()

Arif Qayoom
13 Dec, 2024, 10:51

appwrite_provider.dart

D5
13 Dec, 2024, 10:52

Why are you using a provider for that? ๐Ÿ‘€

Darshan Pandya
13 Dec, 2024, 10:52

make sure you have only one instance of Client. I just saw one Client in AuthProvider, another in AppwriteProvider.

D5
13 Dec, 2024, 10:54

Also, I think the providers are conflicting. I think It's better to have the client as a constant outside of a provider

Arif Qayoom
13 Dec, 2024, 10:54

ummm... I ll fix that For sure!... Can this solve?

Arif Qayoom
13 Dec, 2024, 10:54

Sure I will do the same & Update here in the thread if solved or not

Arif Qayoom
16 Dec, 2024, 15:25

[SOLVED] Current User is Not authorized

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