OAuth Traffic Policy on Endpoints
Sometimes you don't want everyone to be able to access the app at your Endpoints.
This guide will walk you through protecting your apps with OAuth authentication via Traffic Policy. All you need is the ngrok agent CLI.
1. Pick your provider
Decide which OAuth identity provider you want to use. If you don't have an OAuth application configured yet, you can use any of the following providers out of the box:
- GitHub
- GitLab
- Microsoft
- Twitch
This guide will use Google OAuth.
If you use any of the above providers without configuring your own OAuth application, your endpoint will use ngrok's managed OAuth application. This means you won't be able to customize the provider's authentication behavior.
2. Create a traffic policy file
The following is an example Traffic Policy file that executes the 'oauth' traffic policy action on every request to your endpoint.
Create this traffic policy file in the same directory where you run your ngrok agent, or add its contents to your ngrok.yml
agent config file as shown below.
Loading…