This module contains a new way of doing OAuth2 authorization and authentication
in order to obtain an access token and maybe a refresh token based on RFC 6749.
This module will become the default in a future release.
The key concept is introducing grant flows, which determine the entire workflow per the spec.
Each workflow has slightly different request parameters, which is why you'll often see
different configuration options when creating an OAuth2 application in an IdP developer console.
Here are the supported flows:
Authorization Code. This flow requires an authorize call to obtain an authorization code,
then exchange the code for tokens.
Resource Owner Password. This flow only requires hitting the token endpoint with, of course,
username and password, to obtain tokens.
Client Credentials. This flow also only requires hitting the token endpoint, but with different parameters.
The client credentials flow does not involve an end user, so you won't be able to hit the userinfo endpoint
with the access token you obtain.
PKCE (RFC 7636). This is an enhancement on top of the authorization code flow.
The implicit flow is not supported because it is primarily for SPAs (single-page apps),
and it has been deprecated in favor of the authorization code flow with PKCE.
Here is a quick sample showing how to use the vocabulary from this module.
First, initialize your IdP (using Google as an example) and the application.
Additional parameters to the device authorization request.
Most of identity providers follow the spec strictly but
AzureAD requires "tenant" parameter.
Only Authorization Code Grant involves a Exchange Token (Authorization Code).
ResourceOwnerPassword and Client Credentials make token request directly.
Makes a request to the userinfo endpoint using a custom HTTP method.
Some IdPs may require different HTTP methods (instead of GET) or custom headers
for fetching user information. This function provides that flexibility.