Install and configure Auth0

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

NOTE: The steps below assume that you have an Auth0 account. If not, register for a free Auth0 account.

First, create a new Auth0 application as follows:

  • Log in to the Auth0 website and navigate to the “Clients” menu. Click the “Create client” button and choose “Regular Web Application” as the client type.

    Create client

  • Browse to the “Settings” tab for the application in the Auth0 dashboard and note the domain, client ID and client secret.

    Client credentials

  • In the same “Settings” tab, update the “Allowed Callback URLs” field and set it to the value http://DRUPAL_SITE_ADDRESS/auth0/callback. Replace the DRUPAL_SITE_ADDRESS placeholder with the actual IP address of your Drupal host. Save the changes.

    Client callback

Next, install and configure the Auth0 module in your Drupal host as follows:

  • Log in to the server console, change to the application directory. Depending on your installation type, run the following commands:

    • Approach A (Bitnami installations using system packages):

        $ cd /opt/bitnami/drupal/
    • Approach B (Self-contained Bitnami installations):

        $ cd /opt/bitnami/apps/drupal/htdocs/
  • Update Composer:

      $ sudo composer self-update
  • Install the Auth0 module and its dependencies with Composer:

      $ composer require auth0/auth0_drupal:^2.0.0
  • Log in to the Drupal administration panel as an administrator.

  • From the “Extend” menu, select the Auth0 plugin, which should appear in the list of available plugins. Install the plugin by clicking the “Install” button.

    Module installation

  • From the “Configuration -> System” menu, select the Auth0 plugin and configure it with the domain, client ID and client secret obtained from the Auth0 website. Click “Save” to save the changes.

    Module configuration

  • Log out of the Drupal administration panel.

You should now be able to log in to Drupal using Auth0 user credentials. The Drupal login page should also change to reflect Auth0 as a login option.

Drupal Auth0 login

Last modification December 21, 2022