I get the following error after a successful login when ever I call account.get() or account.deleteSession(sessionId: "current"). User (role: guests) missing scope (account)
I am able to print the session and user id after login
TypeScript
func login(_ email: String, _ password: String) async throws -> Session {
let session = try await account.createEmailPasswordSession(email: email, password: password)
self.isLoggedIn = true
print("Session \(session.current)")
return session
}
TypeScript
func logout() async throws {
do {
let response = try await account.deleteSession(sessionId: "current")
print("logout \(response)")
} catch {
print("Error logging out: \(error)")
}
}
TypeScript
func getLoggedInUser() async throws -> User<[String: AnyCodable]> {
let user = try await account.get()
return user
}
TL;DR
Issue: After successful login, developers are encountering an error "User (role: guests) missing scope (account)" when trying to use `account.get()` or `account.deleteSession(sessionId: "current")`.
Solution: Ensure that the user has the necessary scope permissions for the account actions. Double-check the role settings and adjust as needed.Recommended threads
- Local Serverless Function Testing: Are D...
I have followed the instructions to get the CLI working, and have been able to log-in, initialize my project, and created a simple Python function, which calls ...
- Update user email using OTP
Hi, I am trying to implement email update using OTP, there is not password associated with the account. One solution I found online is creating appwrite functio...
- Magic Link token automatically consumed
Hi, I'm using the Magic Link auth system with Appwrite Cloud and I'm running into huge issues getting users to log in successfully. About 9 times out of 10, th...