signly_google 0.1.1 copy "signly_google: ^0.1.1" to clipboard
signly_google: ^0.1.1 copied to clipboard

Flutter plugin-style package that performs one-shot Google Sign-In for Android and iOS and returns only the requested token.

🚀 signly_google #

A modern Google Sign-In wrapper for Flutter using the latest SDK.

  • ✨ Simple API
  • 🔐 Secure token flows
  • 📱 Mobile focused
  • 🧠 Backend ready

✅ Platform support #

Platform Supported
Android
iOS
Web
macOS
Windows
Linux

📦 What you get #

Token / Data Purpose
🪪 idToken (JWT) Authenticate the user on your backend
🔁 serverAuthCode Exchange on backend for refresh token flow
🌐 accessToken Call Google APIs directly
👤 Profile Access user email, name, avatar

🏗️ GCP setup #

Open: Google Auth Overview

Configure:

  • ✔ App name
  • ✔ User support email
  • ✔ Audience
  • ✔ Developer contact email

2) Android OAuth Client #

Open: Google Cloud Credentials

Create OAuth client of type Android and provide:

  • 📦 Package name
  • 🔑 SHA-1 fingerprint

Notes:

  • ✅ Used for Google handshake
  • 🚫 Not passed directly in Flutter code

3) iOS OAuth Client #

Open: Google Cloud Credentials

Create OAuth client of type iOS and provide:

  • 📦 Bundle ID

Then 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 sends users back to your app after login.


4) Web OAuth Client (important for backend flow) #

Open: Google Cloud Credentials

Create OAuth client of type Web Application.

This value becomes your serverClientId, used for:

  • idToken audience
  • serverAuthCode
  • ✅ backend refresh-token flow

🔐 Token meanings #

🪪 idToken #

  • JWT signed by Google
  • Contains user identity claims

🌐 accessToken #

  • Used to call Google APIs
  • ⏳ Short-lived and expires automatically

🔁 serverAuthCode #

  • One-time authorization code
  • Exchanged on backend for long-term refresh flow

📱 Flutter usage #

import 'package:signly_google/signly_google.dart';

final client = SignlyGoogleClient();

final result = await client.signIn(
  GoogleSignInRequest(
    clientId: 'YOUR_PLATFORM_CLIENT_ID',
    serverClientId: 'YOUR_WEB_CLIENT_ID',
    scopes: ['email', 'profile'],
    requestedTokenType: GoogleRequestedTokenType.<token_type>,
  ),
);

Access returned values #

result.requestedToken
result.requestedTokenType.name
result.userId
result.userData.email
result.userData.displayName
result.userData.photoUrl

  • 📱 Flutter obtains idToken + serverAuthCode
  • 🖥️ Backend exchanges auth code and stores refresh token securely
  • ♻️ Backend refreshes access as needed

🚫 Avoid relying only on mobile-side accessToken for long-lived sessions.


📄 License #

MIT

2
likes
145
points
0
downloads

Publisher

verified publisheryudiz.com

Weekly Downloads

Flutter plugin-style package that performs one-shot Google Sign-In for Android and iOS and returns only the requested token.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, google_sign_in

More

Packages that depend on signly_google