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
- Appwrite github organization error
I have github student account. The auth has been paused however the database is working fine. I cant see any option to resume from my console panel. It is just ...
- Appwrite project paused
I have github student account. The auth has been paused however the database is working fine. I cant see any option to resume from my console panel. It is just ...
- Google OAuth Not Working on Brave/Firefo...
I'm having an issue with Google OAuth in my React + Appwrite app. After login, the dashboard is accessible only in Microsoft Edge, but fails in Brave and Firefo...