I've been trying to make login and signup page for my project. I am new to appwrite as well, Whenever, I try to login with the below implementation. It always states general_unauthorized_scope, User (role: guests) missing scope (account) (401). This seems like a permission issue. But I can't find anything related to it in the appwrite console except the API key. When I use the API key using .setJWT(), It says some parts of API key is missing. What is the actual problem here? Am I wrong with this implementation? How do I fix this issue in the first place?
This is my appwrite_controllers.dart file: ``` class AppwriteService { final Client client = Client(); late final Account account; late final Databases databases; late final Storage storage;
AppwriteService() { client .setEndpoint(dotenv.env['API_ENDPOINT']!) .setProject(dotenv.env['PROJECT_NAME']!);
account = Account(client);
databases = Databases(client);
storage = Storage(client);
}
Future<Session?> loginEmailPassword({ required String email, required String password, }) async { try { await account.deleteSessions(); final session = await account.createEmailPasswordSession( email: email, password: password, );
print('User logged in successfully: ${session.$id}');
return session;
} on AppwriteException catch (e) {
print('Error logging in: ${e}');
rethrow;
}
} }
This is my login_screen.dart file (as attachment).
Recommended threads
- Need help to create a wrapper which let ...
I’m looking for help setting up Appwrite properly on a VPS so I can build a self-hosting wrapper around it. The goal is to provide a Linux executable that allow...
- redirect uri not working for OAuth with ...
I'm following this tutorial: https://appwrite.io/blog/post/google-oauth-expo#create-an-expo-app but im using an android development build instead. When I run h...
- Cannot use Apple Oauth2 in React Native/...
Hi! I've trying to add the Apple sign in feature into my Expo App. I followed the docs, but I still receiving the error "Cannot set 'location.href'". Can someon...