Context:
I'm implementing a custom phone number authentication flow using a third-party OTP service. I'm trying to create a session in Appwrite, but encountering an user_invalid_token error.
Current Implementation:
try {
final token = await account.createPhoneToken(
userId: ID.unique(),
phone: phone
);
final id = token.userId;
// Generating custom OTP
generatedOTP = generateOTP();
// Attempting to create session
await account.createSession(userId: id, secret: generatedOTP);
} catch (e) {
print('Error creating user: $e');
}
Additional Details:
-Using Flutter
-Using a third-party OTP generation service
-Getting ** AppwriteException: user_invalid_token, Invalid token passed in the request. (401)**