Ideally I would like to be able to sign in anonymously and persist this user even if they close and reopen the app. Is this possible? Here is what I currently have:
static func ensureUserSession() async -> Result<User, Error> {
let account = Account(client)
do {
let user = try await account.get()
return .success(User(id: user.id))
} catch {
do {
let session = try await account.createAnonymousSession()
print(session.userId)
return .success(User(id: session.userId))
} catch {
return .failure(error)
}
}
}
My issue is twofold:
- Every time I run the app the account.get() fails with the error
User (role: guests) missing scope (account) - When it goes to my catch and calls createAnonymousSession() it succeeds, but creates a new user everytime as I can see in my dashboard.
I do have anonymous login enabled in my dashboard. Am I missing something else?
Recommended threads
- I am currently seeking opportunities as ...
Hey! š I'm a Shopify guy. Been building stores for 8+ years. Still haven't lost my mind. Barely. I make stores that don't suck fast, smooth, and actually built...
- Apple OAuth2 "Registration Not Complete"...
I'm getting a "Registration Not Complete" error when implementing Apple Sign In OAuth2 on self-hosted Appwrite. Environment: Self-hosted Appwrite (latest), iOS...
- Cannot use Apple Oauth2 in React Native/...
Hi! I've trying to add the Apple sign in feature into my Expo App. I followed the docs, but I still receiving the error "Cannot set 'location.href'". Can someon...