Learn how to add "Sign in with Google" to your application in under 10 minutes.
What You'll Build
By the end of this tutorial, you'll have:
Google OAuth configured in Authority
A working "Sign in with Google" button
Users automatically created from Google accounts
Authority running locally or deployed
A Google account for testing
Basic web development knowledge
Step 1: Create a Google OAuth App
Create a new project:
Click the project dropdown at the top
Name it (e.g., "My App Auth")
Enable the OAuth consent screen:
Navigate to APIs & Services > OAuth consent screen
Select External user type
Fill in required fields:
User support email: Your email
Developer contact: Your email
Click Save and Continue through remaining steps
Create OAuth credentials:
Navigate to APIs & Services > Credentials
Click Create Credentials > OAuth client ID
Application type: Web application
Name: "Authority Integration"
Authorized redirect URIs: http://localhost:4000/auth/google/callback
Copy your Client ID and Client Secret
Log in to your Authority admin dashboard at http://localhost:4000/dashboard
Navigate to Settings > Social Login
Find the Google section and configure:
Toggle Enable Google OAuth to ON
Step 3: Test the Integration
Open a new incognito/private browser window
Navigate to http://localhost:4000/auth/google
You should be redirected to Google's sign-in page
Sign in with your Google account
After approval, you'll be redirected back to Authority
Check the admin dashboard - a new user should appear!
Step 4: Add to Your Application
Add a sign-in button to your app:
Step 5: Handle the Redirect
After successful authentication, redirect users to your app:
After authentication, Authority will redirect users to your specified URL with an active session.
What Happens Behind the Scenes
spinner
Adding More Providers
Now that Google is working, add more providers:
"redirect_uri_mismatch"
Your callback URL doesn't match Google's configuration.
Fix: Ensure the redirect URI in Google Console exactly matches:
"Access blocked: App not verified"
You're not a test user for an unverified app.
Fix: In Google Console, go to OAuth consent screen > Test users and add your email.
User Created But No Session
Check that your forward_url is correctly encoded.
Fix: Use btoa() to Base64 encode the URL.