Supabasetyler_shukertTutorial
Getting started with Flutter authentication
Summary
This tutorial shows how to add Google authentication to a cross-platform Flutter application using the Supabase SDK for Flutter. It explains OpenID Connect as a protocol built on OAuth 2.0, then configures Google Cloud client IDs for iOS, Android, and web, with Supabase using the web client ID to verify the supplied identity token. The sample initializes Supabase, starts Google sign-in through google_sign_in, passes the resulting access and ID tokens to signInWithIdToken, and listens for signed-in events to navigate from LoginScreen to ProfileScreen. The profile reads avatar_url and full_name from Supabase userMetadata, while a sign-out action returns the user to the login screen, producing a basic personalized app.
Context
The article addresses implementing third-party Google authentication in a Flutter application, including the use of OpenID Connect identity tokens and displaying basic user information after sign-in.
Approach / What changed
The sample configures Google client IDs in Google Cloud and Supabase, initializes Supabase in Flutter, uses google_sign_in to obtain access and ID tokens, submits them with signInWithIdToken, and provides login and profile screens with authentication-state navigation and sign-out.
Takeaways
Supabase's signInWithIdToken method accepts the Google ID token and access token, then makes the token's content available through the Supabase user's userMetadata.
The Supabase Google provider configuration uses the web client ID as an Authorized Client ID; Android and iOS client IDs are configured for their respective platforms.
The sample's ProfileScreen displays avatar_url and full_name from userMetadata and returns to LoginScreen after calling supabase.auth.signOut().
Source and freshness
- Source
- supabase.com
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.