A simple Android application demonstrating Google Sign-Up using AndroidX Credential Manager and Google Identity Services, built with Kotlin and Jetpack Compose.
The project demonstrates how to integrate a Google Sign-Up button and retrieve Google account information and an ID token using the modern Android credential APIs.
This project is a practical implementation example intended for learning and demonstrating Google authentication integration on Android.
It uses example configuration values rather than real user credentials or production Google account identities.
Important: This is a demonstration project, not a complete production authentication system. It retrieves a Google ID token but does not implement backend authentication, token verification, or account creation.
- Google Sign-Up button integration.
- Google account selection using Credential Manager.
- Google ID token retrieval.
- Access to basic Google account information, including email and display name.
- Asynchronous credential handling using Kotlin Coroutines.
- Modern Android UI built with Jetpack Compose and Material 3.
- Support for Android 8.0 (API 26) and above.
| Technology | Purpose |
|---|---|
| Kotlin | Primary programming language |
| Jetpack Compose | Declarative UI |
| Material 3 | UI components and styling |
| AndroidX Credential Manager | Credential management |
| Google Identity Services | Google ID token credentials |
| Kotlin Coroutines | Asynchronous operations |
| Gradle Kotlin DSL | Build configuration |
- Android Studio with support for the project's Android Gradle Plugin.
- JDK 17 or compatible version required by the configured Android Gradle Plugin.
- Android SDK 37.
- Android device or emulator running Android 8.0 (API 26) or later.
- Google account and Google Play Services for testing.
git clone https://github.com/MagdyDeveloper007/GoogleSignUpExample.gitOpen the project in Android Studio and allow Gradle to synchronize the dependencies.
To test the Google Sign-Up flow with your own Google account:
- Open Google Cloud Console.
- Create or select a Google Cloud project.
- Configure the OAuth consent screen.
- Create an Android OAuth client using your application's package name and signing certificate SHA-1 fingerprint.
- Create a Web application OAuth client.
- Copy the Web Client ID.
Open MainActivity.kt and locate:
val webClientId = "YOUR_WEB_CLIENT_ID.apps.googleusercontent.com"Replace the placeholder with your own Web Client ID.
Note: The example repository does not contain real OAuth credentials. Use your own Google Cloud configuration when testing.
Build and run the application using Android Studio, or execute:
./gradlew assembleDebugOn Windows:
gradlew.bat assembleDebugThe application follows this simplified flow:
- The user taps the Google Sign-Up button.
- Credential Manager initiates the Google account selection flow.
- The user selects a Google account.
- Google Identity Services provides a Google ID token credential.
- The application retrieves the available account information, including email and display name.
The retrieved ID token can subsequently be sent to a trusted backend for server-side verification.
This project is intended for demonstration purposes.
For a production implementation:
- Never hardcode real credentials or sensitive configuration values.
- Never log Google ID tokens, access tokens, or other authentication secrets.
- Send the Google ID token to a trusted backend over HTTPS.
- Verify the ID token on the server side, including its signature, issuer, audience, and expiration.
- Do not treat client-side account information as proof of authentication.
- Implement proper session management and secure logout handling.
- Follow Google's OAuth and authentication security recommendations.
The current implementation focuses on the Android-side Google credential retrieval flow.
It does not include:
- Backend integration.
- Server-side ID token verification.
- User registration or account persistence.
- Application session management.
- Production authentication infrastructure.
No open-source license has been specified for this repository.