How to Create a Self-Hosted Google OAuth 2.0 Client
If you are using Bencher Cloud, then you can simply sign up or log in
using the Google
button.
For Bencher Self-Hosted, you will need to have a Bencher Plus Enterprise plan, create your own Google OAuth2 client, and update your console server configuration and API sever configuration.
Create a Google OAuth 2.0 Client
- Signup for the Google API Console
- Navigate to the
Credentials
page in the left sidebar - Create a
OAuth 2.0 Client ID
- Click
➕ Create Credentials
>OAuth client ID
- Configure consent screen
- Get started
- App Information
- App name
- Choose a name (ex:
Bencher for My Enterprise
)
- Choose a name (ex:
- User support email
- Choose an email address
- App name
- Audience
Internal
- Only available to users within your organization. You will not need to submit your app for verification.
- Contact Information
- Add your email address
- These email addresses are for Google to notify you about any changes to your project.
- Add your email address
- Finish
- Agree to the Google API Services User Data Policy
- App Information
- Get started
- Click
Create OAuth Client
- Application type
- Select
Web application
- Name
- Choose a name (ex:
Bencher for My Enterprise
)
- Choose a name (ex:
- Select
- Authorized JavaScript origins
- Enter your Bencher Console URL (ex:
https://bencher.example.com
)
- Enter your Bencher Console URL (ex:
- Authorized redirect URIs
- Enter your Bencher Console URL suffixed with
/auth/google
(ex:https://bencher.example.com/auth/google
)
- Enter your Bencher Console URL suffixed with
- Click
Create
- Application type
- OAuth Client created
- Note the
Client ID
(ex:012345-abcd6789envs.apps.googleusercontent.com
) - Note the
Client Secret
(ex:GOCSPX-abcdefgh1234567890wxyz
) - Click
OK
- Note the
- Click
🐰 Inactive Google OAuth clients are subject to deletion if they are not used for 6 months. You will be notified of deletion due to inactivity by Google and can restore clients up to 30 days after deletion.
Google OAuth Client Configuration
Console UI
Set the OAUTH_GOOGLE
environment variable to true
when you run the bencher-console
Docker image. (ex: OAUTH_GOOGLE=true
)
If the Client ID is missing, then the Google buttons will not appear in the UI.
API Server
Add the client_id
and client_secret
to the plus.google
section of the server config.
If the Google section is missing, then the server will fail any Google authentication requests.
🐰 Congrats! You have learned how to setup a Google OAuth2 client! 🎉