This method works in tandem with the
initiateOAuthLogin(String) method.
After the user has been redirected to the URL returned by that method
to the external OAuth2 provider and the user has interacted with the provider's
site, the browser is redirected to a URL configured on the provider's web
site. This URL should be that of a pipeline that contains
a script invoking the finalizeOAuthLogin method.
At this point the user has either been authenticated by the external provider
or not (forgot password, or simply refused to provide credentials). If the user
has been authenticated by the external provider and the provider returns an
authentication code, this method exchanges the code for a token and with that
token it requests from the provider the user information specified by the
configured scope (id, first/last name, email, etc.).
The method is aggregation of two other methods -
obtainAccessToken()
and
obtainUserInfo(String, String)
and is provided for convenience. You may want to
use the two individual methods instead if you need more flexibility.
This supports the Authorization Code Flow.