I want to send a verification code to the user and the given phone number and check it and create a session right after the user entered the secret. For me that worked out perfect but after that I want to change the users name but everytime I want to run this it gives me the following error: Error: User (role: guests) missing scope (account). Even if the session is created and is listed on the console of Appwrite. Also happens when running account.get() class Cloud { var client: Client var account: Account var userid = "" var sessionId: String? public init() { self.client = Client() .setEndpoint("https://cloud.appwrite.io/v1") .setProject("MY_PROJECT_ID") self.account = Account(client) } func sendCode(number: String) { Task { do { let token = try await account.createPhoneToken( userId: ID.unique(), // User-ID wird automatisch generiert phone: number ) self.userid = token.userId print("Code wurde gesendet. User-ID: token.userId)") } catch { print("Error1: Failed to send phone token. Error: error.localizedDescription)") } } } func verifyAccount(code: String) { Task { do { var session = try await account.createSession( userId: self.userid, secret: code ) _ = client.setSession(session.id) _ = try await account.updateName(name: "Peter") self.sessionId = session.id print("session created successfully: session.id)") // Ändere $id zu id } catch { print("Error2: Failed to verify account. Error: error.localizedDescription)") } } } }
Recommended threads
- [SOLVED] Appwrite Cloud and FRA cloud se...
Can anyone estimate how long this will take to resolve? I am checking status here https://status.appwrite.online/
- MFA TOTP State Inconsistency After Disab...
MFA TOTP State Inconsistency After Disable/Re-enable Flow — Invalid Token During Verification Environment: - Next.js - node-appwrite - Session-based authentica...
- Running into a server error on my self-h...
Hey everyone, I'm running into a server error on my self-hosted setup after updating to v1.19.0. The issue only happens during user creation and deletion. Ever...