This guide will help you set up Google OAuth authentication for your DataSpace application.
Create a Google Cloud Project
Section titled “Create a Google Cloud Project”- Go to the Google Cloud Console
- Create a new project or select an existing one
- Note down your project ID
Enable Google+ API
Section titled “Enable Google+ API”- In the Google Cloud Console, go to “APIs & Services” > “Library”
- Search for “Google+ API” and enable it
- Alternatively, you can use the newer Google Identity API
Create OAuth 2.0 Credentials
Section titled “Create OAuth 2.0 Credentials”- Go to “APIs & Services” > “Credentials”
- Click “Create Credentials” > “OAuth 2.0 Client IDs”
- Choose “Web application” as the application type
- Configure the OAuth consent screen if prompted
Configure OAuth Client
Section titled “Configure OAuth Client”- Authorized JavaScript origins:
- Add your frontend URL (e.g.,
https://yourdomain.com)
- Add your frontend URL (e.g.,
- Authorized redirect URIs:
- Add your backend callback URL:
https://yourdomain.com/api/auth/google-callback
- Add your backend callback URL:
Get Your Credentials
Section titled “Get Your Credentials”After creating the OAuth client, you’ll get:
- Client ID (looks like:
123456789-abcdefg.apps.googleusercontent.com) - Client Secret (looks like:
GOCSPX-abcdefghijklmnopqrstuvwxyz)
Configure Environment Variables
Section titled “Configure Environment Variables”Add the following environment variables to your application:
GOOGLE_CLIENT_ID=your_google_client_id_hereGOOGLE_CLIENT_SECRET=your_google_client_secret_here