For a deeper dive into authentication concepts and when to use each method, see the Authentication with ngrok blog post.
Authentication and access control methods
| Method | Best for |
|---|---|
| Basic Auth | Quick demos, internal tools |
| OAuth | User-facing apps with social login |
| OpenID Connect (OIDC) | Enterprise apps with corporate IdPs |
| JWT validation | APIs with token-based auth |
| IP restrictions | Network-level access control |
| Mutual TLS (mTLS) | Machine-to-machine, zero trust |
Basic Auth
HTTP Basic Auth is the simplest form of authentication—it prompts visitors for a username and password with zero setup. Use it for one-off demos or sharing local development work.basic-auth action docs for more information.
OAuth
OAuth lets you leverage existing identity providers like Google, GitHub, or Microsoft for authentication. Users sign in with their existing accounts—no password management required. ngrok supports these OAuth providers out of the box with managed applications:- GitHub
- GitLab
- Microsoft
- Twitch
Simple OAuth setup
Restrict access by email domain
Use expressions to restrict access based on email domain, allowing only users from specific organizations.oauth action docs and the OAuth protection guide.
OpenID Connect (OIDC)
OIDC connects to managed corporate identity providers like Okta, Azure AD, or any OIDC-compliant IdP. This gives you fine-grained control over authentication while leveraging your existing identity infrastructure.Basic OIDC setup
Pass identity tokens to your service
Forward the OIDC identity token to your upstream service via headers for further authorization logic.openid-connect action docs for more information.
JWT validation
For APIs, JWT validation lets you verify tokens without managing user sessions. Combine it with rate limiting for robust API protection.Basic JWT validation
JWT validation with rate limiting
Combine authentication with key-based rate limiting for complete API protection.jwt-validation action docs and the Auth0 integration guide for more information.
IP restrictions
Restrict access to specific IP addresses or CIDR ranges. Use this for network-level access control, such as allowing only office IPs or blocking known bad actors.restrict-ips action docs for more information.
Mutual TLS (mTLS)
Mutual TLS requires clients to present a valid certificate, enabling strong machine-to-machine authentication. Use this for zero-trust architectures or when you need to verify client identity at the transport layer. mTLS is configured at the endpoint level rather than through Traffic Policy actions. See the Mutual TLS documentation for setup instructions. Once mTLS is enabled, you can use Traffic Policy to make routing or access decisions based on client certificate details. See the routing by client certificate example.Enforce authentication
Use Traffic Policy to require authentication or apply different rate limits based on authentication status.Reject unauthenticated requests
For APIs that require authentication, immediately reject requests that don’t include anAuthorization header.