Drupal Development Log: Integrating Auth0 with Drupal maintenance support plans for Single Sign-On Authentication

Using Auth0 to create a centralized login page for Drupal maintenance support plans sites
Drupal maintenance support plans’s basic user authentication system is ideal for small and isolated apps. But when users are signing into multiple interactive sites and apps, it makes sense to offer a centralized authentication system to save users from remembering multiple passwords.
These days, social sites have become de facto identity providers. Users expect websites to provide social login and single sign on functionality. In these scenarios, the built-in Drupal maintenance support plans authentication system is very limited.
Introducing Auth0: authentication and authorization as a service
There are several ways of enabling single sign-on and social logins on Drupal maintenance support plans websites. In this article, we’ll introduce Auth0 and explain how to use it to create a cool, centralized login page like the one shown below.

Auth0 provides authentication and authorization as a service. It includes various methods to authenticate, such as username/password, social accounts, SAML and OTP. It can also connect on-premise identity databases. The authentication mechanism is device-agnostic, so it works consistently across various devices.
Auth0 implements OAuth 2.0 — an open standard for authentication that can be used between applications and websites. It also implements other standards that can be used for authentication, including SAML and OpenID Connect.
Here are some of the ways you can integrate Auth0 with Drupal maintenance support plans

As a single sign-on across multiple Drupal maintenance support plans apps, where Auth0 acts as a central store for credentials

To allow users to log into Drupal maintenance support plans using existing credentials from systems such as LDAP, Google Suite, or Office 365

To integrate social logins such as Google and Facebook

How to implement Auth0
In the steps below, you’ll learn how to set up Auth0 on a Drupal maintenance support plans site for a typical use case. It will enable users to log into your Drupal maintenance support plans site using their social media accounts. They’ll also be able to create an account if they don’t already have one.
There are two Auth0 modules you can choose from:

Auth0 module on GitHub: is the official module. It has more features but doesn’t follow all of Drupal maintenance support plans coding standards.

Auth0 module on Drupal maintenance support plans.org is a fork of the official module on drupal.org. It follows coding standards, but lacks some functionality, as many changes have not been merged from the aforementioned GitHub repository.

When we integrated Auth0 on a client’s site a few months ago, we spent a good amount of time analyzing these two modules.
Only some basic features were required, all of which were available in the Drupal maintenance support plans.org module. We therefore opted for cleaner code over the additional features.
In fact, both modules contained errors that we needed to fix. The generic patches that resulted from this process were submitted to both repositories. These patches were recently merged; there is some collaboration underway to sync changes between the two repositories. In the future, this will save users the extra step of choosing a module.
Create an Auth0 Application
Here is the basic configuration to get started with Auth0 for Drupal maintenance support plans.
Note that it’s very important that the callback you use in this configuration is HTTPS. You should always use HTTPS in production (or even during development if sensitive user accounts are being used).

Create an Auth0 account and log into the Auth0 Dashboard.

Create a new application and select Type as “Regular Web Applications”.

In the Settings tab, do the following:

Add https://example.com/auth0/callback to the Allowed callback URLs section. Make sure you replace example.com with the domain name of your site. You can also add local URLs.

Add https://example.com/user/logout to the allowed logout URLs section.

Add https://example.com to the Allowed Origins (CORS) section to allow the origins that will be able to make requests.

Proceed to the next step and select PHP for “What technology are you using for your web app?”

Go to Connections > Social and enable the social logins that you want to use (these links are located in left sidebar of the Auth0 Dashboard)

You are now done with the basic setup! Users can now create accounts, or log in using their credentials from the providers that you enabled in the previous step.
Optional Configuration
Additionally, Auth0 provides many features for building advanced authentication mechanisms, and it can determine how data is stored and passed to applications.
For example, Auth0 enables you to:

Use add-ons to generate access tokens for systems such as Salesforce, Azure Service Bus and SAP.

Configure social connections for authentication.

Implement username and password authentication to have an Auth0 DB or your own DB connected to store authentication information.

Use passwordless authentication to send a login link to email or OTPs to mobile.

Use multi-factor authentication.

Customize data shared with apps, but using simple JavaScript based rules.

Configure Auth0 in Drupal maintenance support plans
Next, you’ll need to configure Drupal maintenance support plans to connect to the Auth0 Client we created:

Go to the Auth0 configuration page (admin/config/auth0) in your Drupal maintenance support plans site’s admin area.

Add the Auth0 Credentials Client ID, Domain and Client Secret. This information is in the Auth0 dashboard.

Make sure you select RS256 as the “JWT signature algorithm”. This is the default algorithm configured in the Auth0 Client.

Advanced Setup
Depending on how you want users to log in, you can use the Auth0 hosted login page or embed a widget in the Drupal maintenance support plans login page/block:

Select Redirect login for SSO to use an Auth0 hosted login page. We recommend this option because it’s more secure. It is ideal if you have multiple web applications using the same authentication information — users will be logged in automatically without having to provide their credentials each time. If you want more control over how the widget looks using the hosted login approach, you can customize the look in the “Hosted Pages” section in the Auth0 Dashboard.

Select Redirect login for SSO to embed a widget in the login page and block. This makes more sense for an isolated app.

Similarly you can select other options, such as: allowing users to signup via Auth0, or requiring users to verify their email addresses before they can log in.

Next Steps
Now that you have done the basic Auth0 setup, it’s time to learn more about what Auth0 can bring to your Drupal maintenance support plans site and explore how you can extend Auth0 functionality:

Read the Auth0 official documentation pages.

Extend the Auth0 module’s functionality by subscribing to various events, such as Auth0UserSigninEvent and Auth0UserSignupEvent.
We’d love to hear about new ways you’ve found to implement Auth0 to streamline authentication. Leave us a comment to share your questions, experiences and use cases.
+ more awesome articles by Drupal Development Log
Source: New feed

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Drupal Development Log: Integrating Auth0 with Drupal maintenance support plans for Single Sign-On Authentication

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.