Rank 1: Thread
Hi Appwrite team,
I’m using Appwrite Auth in a Flutter mobile app and trying to upgrade an anonymous user to Google OAuth.
Docs say that if there is already an active session, a new OAuth2 session should be attached to the currently logged-in account. But in Flutter, createOAuth2Session() creates/logs in a different Google Auth user instead of attaching Google to the existing anonymous user.
Environment:
Flutter app
Appwrite Flutter SDK 18.0.0
Platform: Android
Provider: Google OAuth2
Flow:
Create anonymous session
Complete onboarding
From profile, call Google OAuth while anonymous session is still active
Code:
`final before = await account.get();
final beforeSession = await account.getSession(sessionId: 'current');
await account.createOAuth2Session(
provider: OAuthProvider.google,
scopes: ['email', 'profile'],
);
final after = await account.get();
final afterSession = await account.getSession(sessionId: 'current');`
Logs:
`before userId=6a1735f10af0d84b8fe2
before provider=anonymous
after userId=6a1736370ef80119884d
after provider=google
attachedToPreviousSession=false`
Expected:
after.$id should equal the anonymous user id.
Actual:
Appwrite creates/logs in a different Google Auth user, so I end up with 2 Auth users: anonymous + Google.
Question:
Is anonymous -> OAuth upgrade supported in Flutter/native via createOAuth2Session()