Back
AppwriteException: general_unauthorized_scope, User (role: guests) missing scope (account) (401)
- 0
- Flutter
- Auth
Hi, I currently have this logic:
TypeScript
Future<void> loginWithGitHub(BuildContext context) async {
try {
await account.createOAuth2Session(provider: OAuthProvider.github);
var user = await getUser();
if (user == null) {
logger.w("User not found after GitHub login");
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text("Error during GitHub login! Please try again")));
return;
}
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => Example(user: user)),
);
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text("Error during GitHub login! Please try again")));
logger.e("Error during GitHub login", e);
}
}
When calling it one Time, I get this error:
TypeScript
AppwriteException: general_unauthorized_scope, User (role: guests) missing scope (account) (401)
but when calling it again, it somehow works. What am I doing wrong?
TL;DR
Issue: The error 'AppwriteException: general_unauthorized_scope, User (role: guests) missing scope (account) (401)' is occurring when trying to log in with GitHub.
Solution: The error is due to missing scope (account) for the user's role (guests). Make sure to grant the necessary scope for the role to access the account.Recommended threads
- SSR Auth with Tanstack Start requires ha...
I followed the Next.js guide for SSR Auth on https://appwrite.io/docs/tutorials/nextjs-ssr-auth/step-1 I tried to replicate it for Tanstack Start. However, on...
- how can i make a relationship between a ...
i want to relate the $id from users auth table in appwrite with other column in my table user_profile. because is the same user... how can i have exactly the s...
- `type 'Null' is not a subtype of type 'b...
When creating a new file using Appwrite Flutter SDK, the file is successfully created on the server, but the client throws the following exception: ``` type ...