Skip to content
Back

Flutter OAuth2 does not attach Google session to existing anonymous session

  • 0
  • Flutter
  • Auth
  • Cloud
ichemer
27 May, 2026, 18:31

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()

TL;DR
Appwrite Flutter SDK is not attaching Google OAuth2 session to the existing anonymous session as expected. Autwrite currently does not support upgrading from an anonymous session to Google OAuth in Flutter/native via createOAuth2Session().
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more