Next.js for Drupal

Authentication Example

This is an example on how to implement authentication in Next.js for Drupal.

There are two OAuth 2.0 grants implemented: the Password Grant and the Authorization Code Grant.

Password Grant

The Password grant allows users to login with their credentials i.e a username and a password.

Authorization Code Grant

The Authorization Code Grant redirects the user to the authorization server, in this case Drupal, for authentication.

The user will then be asked to login to the authorization server and approve the client.

Login to your Account

You can use username: member and password: member to login.

We are using next-auth to handle authentication on the Next.js side and Simple OAuth on the Drupal side.