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
- SSL certificate issuance failed:
Domain verifies but SSL cert fails, tried different subdomains like .api and .aw, used cname and CAA, no prior CAA existed on website, tried Multiple CAAs at on...
- Migration from Self-Hosted to Cloud seem...
Hello, I'm trying to migrate from my Self-Hosted Appwrite instance to Cloud, and can't figure out what's going wrong. - If I initiate the migration from Cloud...
- Deployment fails after 15+ minutes: "Wai...
Hi, I'm Jayden. My email is jaydthom@haverford.org, and i'm having persistent deployment failures with my Next.js project. What happens: Push to GitHub trigg...