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
- FCM Message error
When creating a message target via flutter sdk via ``` final target = await _account.createPushTarget( targetId: targetId, identifier: deviceTok...
- Getting current user has been blocked
Getting current user has been blocked error while signing in the appwrite console. Got this during I am testing with the my saas web project. Please help to unb...
- vorafy.studio domain already exists erro...
My domain vorafy.studio is stuck/locked from a previously deleted project. I created a new project but can't add the domain — getting 'already exists' error. Pl...