This guide refers to using SSO to authenticate access to your endpoints. You cannot use these instructions to set up SSO for logging into your ngrok account in the dashboard.
- Restrict access to ngrok endpoints to only users who authenticated via Azure AD B2C
- Allow users to authenticate via a local account or federated accounts via Azure AD B2C
What you’ll need
- An ngrok Pay-as-you-go account with an authtoken or admin access to configure endpoints with SAML.
- A Microsoft Azure account with access to an Azure AD B2C tenant.
- An understanding of Azure AD B2C custom policies.
1. Configure ngrok
Once you have developer preview access, create apolicy.yaml file with the following content.
Leave YOUR_IDP_METADATA_XML as a placeholder for now; you replace it with the metadata XML from Azure AD B2C in a later step.
2. Create a SAML application in Azure AD B2C
Azure AD B2C doesn’t support SAML applications through user flows, so you configure it as a SAML identity provider with custom policies. Follow Microsoft’s guide, Configure Azure AD B2C as a SAML IdP to your applications, to set up the custom policies, register your SAML application, and expose the Azure AD B2C SAML metadata endpoint. When you register the application, use the following mapping to enter the ngrok values you retrieved in the previous step:3. Update the ngrok configuration with the IdP metadata
- Retrieve the IdP metadata XML from the Azure AD B2C SAML metadata endpoint.
The URL follows this format:
https://<tenant-name>.b2clogin.com/<tenant-name>.onmicrosoft.com/<policy-name>/Samlp/metadata. - Update the
idp_metadatavalue in yourpolicy.yamlwith the metadata XML, replacing the placeholder value you set earlier. - Restart the endpoint so it picks up the updated policy.
4. Test the integration
Run:ngrok http 3000 --traffic-policy-file policy.yaml --url YOUR_DOMAIN
- Access your ngrok endpoint via your forwarding URL.
- In your browser, launch an incognito window.
- When prompted, log in or sign up.
- After you log in, you see the application.