Setting up Auth0
Set up an Auth0 login screen for visitors to your docs.
Last updated
Was this helpful?
Set up an Auth0 login screen for visitors to your docs.
Last updated
Was this helpful?
This guide takes your through setting up a protected sign-in screen for your docs. Before going through this guide, make sure you’ve first gone through Enabling authenticated access.
To setup your GitBook site with authenticated access using Auth0, the process looks as follows:
Create an Auth0 application in your Auth0 dashboard.
Install the Auth0 integration and add the required configuration to your GitBook site.
Configure Auth0 to work with adaptive content in GitBook.
Start by creating a new application in your Auth0 platform dashboard. This application will allow the GitBook Auth0 integration to request tokens to validate user identity before granting them access to your site.
Sign in to your Auth0 dashboard.
Head to Applications > Applications section from the left sidebar.
Click on the + Create Application button, and give your app a name.
Under the Choose an application type, select Regular Web Applications.
In the Quickstart screen of the newly created app, select Node.js (Express) and then I want to integrated my app.
You should then see a configuration screen like below. Click Save Settings And Continue.
Click on the Settings tab.
Copy and make note of the Domain, Client ID and Client Secret.
Please ensure that you have at least one connection enabled for your Auth0 application under the Connections tab.
Once you've created the Auth0 application, the next step is to install the Auth0 integration in GitBook and link it with your Auth0 application using the credentials you generated earlier:
Navigate to the site where you've enabled authenticated access and want to use Auth0 as the identity provider.
Click on the Integrations button in the top right from your site’s settings.
Click on Authenticated Access from the categories in the sidebar.
Select the Auth0 integration.
Click Install on this site.
After installing the integration on your site, you should see the integration's configuration screen:
Enter the Domain, Client ID and Client Secret values you copied after creating the Auth0 application earlier. For Auth0 Domain, enter the Domain copied from Auth0 (make sure to prefix it with https://
).
(optional) Enable the Include claims in JWT token option at the bottom of the dialog if you have enabled your site for adaptive content.
Copy and make note of the Callback URL displayed at the bottom of the dialog.
Click Save.
Head back to the Auth0 application you created earlier in the Auth0 dashboard.
Browse to Applications > Applications in the sidebar and select the Settings tab.
Scroll down to the Application URIs section of the settings
Paste the Callback URL you copied earlier from the GitBook integration dialog into the Allowed Callback URL input field.
Click Save.
Head back to Auth0 integration installation screen in GitBook.
Close the integration dialogs and click on the Settings tab in the site screen.
Browse to Audience and select Authenticated access (if not already selected).
Select Auth0 from the dropdown in the Authentication backend section.
Click Update audience.
Head to the site's overview screen and click Publish if the site is not already published.
Your site is now published behind authenticated access using your Auth0 as identity provider.
To test it out, click on Visit. You will be asked to sign in with Auth0, which confirms that your site is published behind authenticated access using Auth0.
To leverage the Adaptive Content capability in your authenticated access site, configure the Auth0 application to include additional user information in the authentication token as claims.
These claims, represented as key-value pairs, are passed to GitBook and can be used to adapt content dynamically for your site visitors.