![](https://cdn.discordapp.com/avatars/694860238725185546/bf554cc80eaaf64a05b14f402ce4cf4e.webp)
This is my code for login phone session
TypeScript
@override
Future<am.Token> loginPhone({required String phoneNumber}) async {
try {
final sessionToken = await account.createPhoneSession(
userId: ID.unique(),
phone: phoneNumber,
);
return sessionToken;
} on AppwriteException catch (e, stackTrace) {
_logger.severe(
'Error logging in with phone number',
e,
stackTrace,
);
throw AccountException(
e.message ?? 'Error logging in with phone number',
stackTrace,
);
} catch (e, stackTrace) {
_logger.severe(
'Error logging in with phone number',
e,
stackTrace,
);
throw AccountException(
'Error logging in with phone number',
stackTrace,
);
}
}
Now when I want to resend code if ever the user want to resend the code. I use this code:
TypeScript
@override
Future<am.Token> createPhoneVerificationCode() async {
try {
final token = await account.createPhoneVerification();
return token;
} on AppwriteException catch (e, stacktrace) {
_logger.severe(
'Failed to create phone verification code',
e,
);
throw AccountException(
e.message ?? 'Failed to create phone verification code',
stacktrace,
);
} catch (e, stacktrace) {
_logger.severe(
'Failed to create phone verification code',
e,
);
throw AccountException(
e.toString(),
stacktrace,
);
}
}
TL;DR
Developers are encountering an "AppwriteException" error with the message "general_unauthorized_scope." This error occurs because the user, who has the role of "guests," is missing the "account" scope.
To resolve this issue, the user needs to be granted the "account" scope.
Additionally, the developers are also trying to resend a phone verification code. They have provided code snippets for the login process and code generation.
However, it is unclear if there are any issues with the code for resending the verification code. No specific errors or problems are mentioned in the thread. ![](https://cdn.discordapp.com/avatars/694860238725185546/bf554cc80eaaf64a05b14f402ce4cf4e.webp)
This is the error:
But I got an error:
TypeScript
I/flutter (26118): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (26118): │ AppwriteException: general_unauthorized_scope, User (role: guests) missing scope (account) (401)
I/flutter (26118): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (26118): │ #0 _debugLogger (package:ems/src/core/guard_shell.dart:71:15)
I/flutter (26118): │ #1 guardShell.<anonymous closure> (package:ems/src/core/guard_shell.dart:40:5)
I/flutter (26118): │ #2 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
I/flutter (26118): │ #3 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
I/flutter (26118): │ #4 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
I/flutter (26118): │ #5 _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:377:25)
I/flutter (26118): │ #6 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:244:5)
I/flutter (26118): │ #7 Logger._publish (package:logging/src/logger.dart:309:51)
I/flutter (26118): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (26118): │ ⛔ SEVERE: 2024-02-11 15:06:19.643761: AccountService: Failed to create phone verification code
I/flutter (26118): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
![](https://cdn.discordapp.com/avatars/694860238725185546/bf554cc80eaaf64a05b14f402ce4cf4e.webp)
But I am still receiving SMS code
Recommended threads
- Google Oauth: missing redirect url, appw...
I am doing Google Oauth in flutter app using Appwrite My appwrite is selfhosted running locally on my laptop in a docker container. I had my reasons to tunnel...
- Hi all, can someone help me with 2FA imp...
I am in need of help with implementation of 2FA method in my project.
- Teams.listMemberships() not working on F...
I have a appwrite server function querying my memberships as this; ``` teams = Teams(client) data = json.loads(request.payload or "{}") queries = [] ...
![](/images/bgs/pre-footer.png)