π signly_google
A modern Google SignβIn wrapper for Flutter using the latest SDK.
β¨ Simple API
π Secure token flows
π± Mobile friendly
π§ Backend ready
π¦ What you get
| Icon | Token | Purpose |
|---|---|---|
| πͺͺ | idToken (JWT) | Authenticate user on backend |
| π | serverAuthCode | Exchange for refreshToken |
| π | accessToken | Call Google APIs |
| π€ | Profile | Email, name, avatar |
π GCP SETUP
πͺ Step 1: OAuth Consent Screen
π Google Cloud Console β APIs & Services β OAuth Consent Screen
β App name
β Support email (User support)
β Audience
β Developer email (Contact info)
π€ Step 2: Android OAuth Client
Type: Android
Provide:
π¦ Package name
π SHAβ1 fingerprint
β
Used for handshake only
π« Not passed in Flutter code
π Step 3: iOS OAuth Client
Type: iOS
Provide:
π¦ Bundle ID
Add in ios/Runner/Info.plist
<key>GIDClientID</key>
<string>YOUR_CLIENT_ID.apps.googleusercontent.com</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.YOUR_CLIENT_ID</string>
</array>
</dict>
</array>
π URL scheme returns user back to app after login
π Step 4: Web OAuth Client (IMPORTANT)
Type: Web Application
π― This is your serverClientId
Used for:
β
idToken audience
β
serverAuthCode
β
backend refresh flow
π Token meanings
πͺͺ idToken
JWT signed by Google
Contains user identity
π accessToken
Call Google APIs
β³ Expires automatically
π serverAuthCode
Oneβtime code
Backend β refreshToken + accessToken
π± Flutter Usage
import 'package:signly_google/signly_google.dart';
final client = SignlyGoogleClient();
final result = await client.signIn(
GoogleSignInRequest(
clientId: ...
serverClientId: ...
scopes: ['email', 'profile'],
requestedTokenType: GoogleRequestedTokenType.<token_type>,
);
Access values
result.requestedToken
result.requestedTokenType.name
result.userId
result.userData.email
result.userData.displayName
result.userData.photoUrl
π§ Best Practice Flow
π± Flutter β idToken + authCode
π₯ Backend β refreshToken
β» Backend refreshes forever
π« Do NOT rely only on mobile accessToken
π License
MIT