Back

guest scope issues when signing in on ios and android

  • 0
  • General
  • Flutter
  • Users
  • Accounts
๐ŸœUdon๐Ÿœ
20 Sep, 2023, 17:28

Hello, I'm using the same flutter code on my web and my mobile version. I can still log in with my ios and android but only after I get the guest scope missing error and then I hot reload and I'm logged in. This started happening when I updated to the latest version. Tried downgrading didn't help. Do I need to ad self-signed in my main.

TL;DR
The user is experiencing guest scope issues when signing in on iOS and Android after updating to the latest version of the Appwrite SDK. They are unsure which part of the code is causing the exception. The user shares their code for signing in and asks if they need to add self-signed in their main. Solution: It is suggested that the user adds the 'dart' syntax after the three backticks to add syntax highlighting for their code. Additionally, it is recommended to check if the 'await _account.get()' line is throwing the exception. Upgrading to version 1.4.3 of Appwrite is also mentioned as a possible
Drake
20 Sep, 2023, 17:58

what's your code that throws the scope error?

๐ŸœUdon๐Ÿœ
20 Sep, 2023, 18:57

Same as my normal web code ```@override Future signIn( {required String email, required String password, required BuildContext context}) async { try { if (isValidEmail(email)) { final session = await context.authNotifier .createEmailSession(email: email, password: password); _currentUser = await _account.get(); return right(session); } final document = await _db.listDocuments( databaseId: AppwriteConstants.databaseId, collectionId: AppwriteConstants.usersCollection, queries: [ Query.search('userName', email), ], ); final user = UserModel.fromMap(document.documents.first.data); final responseWithUserName = await context.authNotifier.createEmailSession( email: user.email, password: password, ); _currentUser = await _account.get();

TypeScript
  return right(responseWithUserName);
} on AppwriteException catch (e, stackTrace) {
  Failure(e.message ?? 'Some unexpected error occurred', stackTrace);
} catch (e, stackTrace) {
  return left(
    Failure(e.toString(), stackTrace),
  );
}

}```

๐ŸœUdon๐Ÿœ
20 Sep, 2023, 18:57

I use both username and email to log in. However even when I just use email I still get the same guest scope missing error

Drake
20 Sep, 2023, 20:14

fyi, you can add dart after the 3 backticks to add syntax highlighting

Drake
20 Sep, 2023, 20:14

so you're saying that await _account.get() is throwing the exception?

๐ŸœUdon๐Ÿœ
20 Sep, 2023, 21:17

I don't even know which part is causing the exception

๐ŸœUdon๐Ÿœ
20 Sep, 2023, 21:17

Got you and I'll resend the code

๐ŸœUdon๐Ÿœ
20 Sep, 2023, 21:18

Same as my normal web code ``` dart @override Future signIn( {required String email, required String password, required BuildContext context}) async { try { if (isValidEmail(email)) { final session = await context.authNotifier .createEmailSession(email: email, password: password); _currentUser = await _account.get(); return right(session); } final document = await _db.listDocuments( databaseId: AppwriteConstants.databaseId, collectionId: AppwriteConstants.usersCollection, queries: [ Query.search('userName', email), ], ); final user = UserModel.fromMap(document.documents.first.data); final responseWithUserName = await context.authNotifier.createEmailSession( email: user.email, password: password, ); _currentUser = await _account.get();

TypeScript
  return right(responseWithUserName);
} on AppwriteException catch (e, stackTrace) {
  Failure(e.message ?? 'Some unexpected error occurred', stackTrace);
} catch (e, stackTrace) {
  return left(
    Failure(e.toString(), stackTrace),
  );
}

}```dart

๐ŸœUdon๐Ÿœ
20 Sep, 2023, 21:35

Nevermind I tried the dart syntax and couldn't make it show up on discord ๐Ÿ˜… and with the code not sure why it throws the exception only on mobile and it didn't used to before I updated to the latest appwrite

Drake
20 Sep, 2023, 22:42

you should be adding dart right after the first 3 backticks only (on the same line as the backticks)

Drake
20 Sep, 2023, 22:43

you should be able to see from the stacktrace or by using the debugger

Drake
20 Sep, 2023, 22:44

you said you upgraded. you upgraded the Appwrite SDK? or Appwrite? What version of each are you on?

๐ŸœUdon๐Ÿœ
21 Sep, 2023, 01:06

I updated both. I'm on appwrite sdk 11 and appwrite 1.4.2

๐ŸœUdon๐Ÿœ
21 Sep, 2023, 01:17

Maybe because I updated the appwrite sdk?

Drake
21 Sep, 2023, 01:21

version 11.0.0 of the sdk should be fine with 1.4.2 of Appwrite.

It would help if you figured out which API call was throwing the exception.

Also, FYI, 1.4.3 was released so you might want to upgrade to that

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