"google" for OAuth in your Traffic Policies without specifying a Google OAuth application, visitors are authenticated using ngrok’s managed Google OAuth instance.
Setting up your own Google OAuth application lets you customize authentication in more detail.
This guide walks you through creating a Google OAuth 2.0 application for your ngrok endpoints.
What you’ll need
- A Google Cloud Platform account and project.
- Your ngrok authtoken and an endpoint with the OAuth action in its Traffic Policy.
1. Build the consent screen
- Create or select a project in the Google Cloud Platform Console.
- Open the project’s OAuth consent screen.
- Select whether your application is an internal or external app.
- Fill out the application name and support email.
- Add any additional scopes required by your application and save the full scope URI for later.
- Ensure the
emailandprofilescopes remain selected. - Under Authorized domains, add
ngrok.comand your application homepage domain. - Add links to your application homepage and privacy policy.
- Save the application.
- Applications that require verification cannot complete the consent screen and are not supported by ngrok.
2. Create credentials for ngrok
- Open Credentials for your project.
- Click Create credentials in the top menu and select OAuth client ID.
- Choose Web application from the list of application types.
- Name your client, set Authorized redirect URIs to
https://idp.ngrok.com/oauth2/callback, and complete the form. - Securely store the Client ID and Client secret from the final screen.
3. Update your ngrok endpoint Traffic Policy
- Access the ngrok Dashboard Endpoints page and locate an existing endpoint you’d like to add this to or create a new one.
- In your traffic policy, add the following configuration:
You may add any scopes that are required by your application with the following caveats.
- Scopes which require a Facebook app review are unsupported.
- ngrok will enforce that users accept all permissions before completing authorization.
Configure access control
Optionally, configure access control to your service by only allowing specific users or domains.- By Email
- By Name
Further resources
- Google OAuth 2.0 Web Server (prerequisite steps)
- GCP Help: Setting up OAuth 2.0
- Google OAuth 2.0 workflow