How to authenticate users in Next.js for Drupal.
To authenticate Drupal users in our Next.js type we can implement one of two grants.
A grant is a method of acquiring an access token.
The two grants we can use are:
Deciding which grants to implement depends on the type of client the end user will be using, and the experience you want for your users.
The Password Credentials Grant allows users to authenticate with a username and password while the Authorization Code Grant takes the user off-site to the authorization server (the Drupal site) for authentication.
Use the Password Grant for first party clients only i.e. you own the Next.js sites.