Skip to content
Back

OAuth2 and Email/Passwort is not working on iOS not working

  • 0
  • Flutter
  • Auth
  • Cloud
Seroga88i
20 Jul, 2025, 20:09

Hello guys, after updating to the latest Appwrite Flutter package (17.0.1) I am facing completely weird behavior. None of my login ways are working. Whether the normal email/password:

TypeScript
Future<void> signIn(String email, String password) async {
    state = const AsyncValue.loading();
    try {
      await _wrapAppwriteCall(() async {
        final session = await _account.createEmailPasswordSession(
            email: email, password: password);
        final user = await _account.get(); <-- Fails here
      });
    } ...
  }

I get a valid session after the createEmailPasswordSession request, but the next request is failing with this error AppwriteException (AppwriteException: general_unauthorized_scope, User (role: guests) missing scope (account) (401)) No clue what I am doing wrong or what changed. When I use the OAuth2 way then it is completely random behavior.

TypeScript
  Future<void> signInOAuth(String providerName) async {
    state = const AsyncValue.loading();
    try {
      await _wrapAppwriteCall(() async {
        final OAuthProvider provider;
        if (providerName == 'Google') {
          provider = OAuthProvider.google;
        } else {
          provider = OAuthProvider.apple;
        }
        await _account.createOAuth2Session(provider: provider);
        final session = await _account.getSession(sessionId: 'current');
        final user = await _account.get();
      });
    }....
  }

When I use google then it depends on the email account I select which error message I get. For one user I get this error: AppwriteException (AppwriteException: general_unauthorized_scope, User (role: guests) missing scope (account) (401)) For another user I get this error:Missing redirect URL This is totally weird behavior. Please give me a hint what could be wrong

TL;DR
Issue: After updating to the latest Appwrite Flutter package, both the email/password login and OAuth2 login are not working on iOS. For email/password login, the createEmailPasswordSession call is successful, but the subsequent request fails with "general_unauthorized_scope." For OAuth2 login, using Google results in different errors based on the selected email account. Solution: The error "general_unauthorized_scope" suggests that the user is missing the 'account' scope. Check the user roles and scopes. Ensure that the user has the necessary scopes for the actions being performed. For the OAuth2 Google login, verify that the redirect URL is correctly
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