OAuth
Overview
The OAuth Traffic Policy action restricts access to only authorized users by enforcing OAuth through an identity provider of your choice.
Configuration Reference
The Traffic Policy configuration reference for this action.
Supported Phases
on_http_request
Type
oauth
Configuration Fields
providerstringRequired
The name of the OAuth identity provider to be used for authentication.
auth_idstring
Unique authentication identifier for this provider. This value will be used for the cookie, redirect, authentication and logout purposes.
To login a user you must use
/ngrok/login?auth_id={auth_id}
. If you are using path based auth you must include the path to be redirected back to:?redirect_path=/foo
To log a user out you must use
/ngrok/logout?auth_id={auth_id}
You additionally can provide a path to redirect the user to on logout:
?redirect_path=/
client_idstring
Your OAuth app's client ID.
Leave this empty if you want to use ngrok’s managed application.
client_secretstring
Your OAuth app's client secret.
Leave this empty if you want to use a managed application.
scopesarray of strings
A list of additional scopes to request when users authenticate with the identity provider.
authz_url_paramsmap of string to string
A map of additional URL parameters to apply to the authorization endpoint URL.
max_session_durationduration
Defines the maximum lifetime of a session regardless of activity.
idle_session_timeoutduration
Defines the period of inactivity after which a user's session is automatically ended, requiring re-authentication.
userinfo_refresh_intervalduration
How often should ngrok refresh data about the authenticated user from the identity provider.
allow_cors_preflightboolean
Allow CORS preflight requests to bypass authentication checks. Enable if the endpoint needs to be accessible via CORS.
Default:
false
auth_cookie_domainstring
Sets the allowed domain for the auth cookie.
Special Paths
Path | Description |
---|---|
/ngrok/login | Redirect users to this path to explicitly begin an authentication flow. After authentication, users will be redirected to / . If the IdP supports it, ngrok will attempt to instruct the IdP to force re-authentication which will force users to re-enter their credentials with the IdP even if they were already logged in. |
/ngrok/logout | Logs the user out by clearing their session cookie. Redirect users to this path to log them out. |
Events
When this action is enabled, it populates the following fields in the http_request_complete.v0 event:
Fields |
---|
oauth.app_client_id |
oauth.decision |
oauth.user.id |
oauth.user.name |
Supported Providers
ngrok currently supports the following OAuth providers (see the Integration Guides for more details). In some instances, ngrok has a managed application that allows you to configure OAuth without setting up your own application in your provider. This is useful for testing and development, but when you move into production, we recommend using your own custom application in your specific provider.
Provider | Provider Identifier | Managed App Available | Integration Guide |
---|---|---|---|
Amazon | amazon | no | Documentation |
facebook | no | Documentation | |
GitHub | github | yes | Documentation |
GitLab | gitlab | yes | Documentation |
google | yes | Documentation | |
linkedin | yes | Documentation | |
Microsoft | microsoft | yes | Documentation |
Twitch | twitch | yes | Documentation |