Web applications
For web applications, the typical grant type to request access to protected resources is authorization_code. The /{{envID}}/as/authorize endpoint supports GET and POST methods and returns the authorization code needed to acquire an access token. After an authorization code is returned successfully, the code is used to get the access token.
The following sample shows the GET /{{envID}}/as/authorize operation.
https://auth.pingone.com/{{envID}}/as/authorize?response_type=code&client_id={{appID}}&redirect_uri={{redirect_uri}}&scope=openid%20profile%20email&acr_values=Single_Factor&prompt=login
The request URL contains the following parameter values:
-
response typeSpecifies the response type for the authorization request. If the grant type is
authorization_code, theresponse_typeparameter must have a value ofcode. This parameter is required. -
client_idSpecifies the application’s UUID, returned from a
GET /environments/{{envID}}/applications/{{appID}}request. This parameter is required. -
redirect_uriProvides a URL that specifies the return entry point of the application. This parameter is required.
To ensure proper redirect on some iOS and OSX browsers, the redirect_urivalue must include a trailing slash. For example, a registered URI ofhttps://www.pingidentity.com/redirects properly tohttps://www.pingidentity.com/#access_token=eyJsdf, but a registered URI ofhttps://www.pingidentity.comredirects incorrectly to https://www.pingidentity.com/en.html, and the client application would not receive the access token. -
scopeSpecifies permissions that determine the resources that the application can access. This parameter is not required, but it is needed to specify accessible resources.
-
acr_valuesAn optional parameter that designates whether the authentication request includes specified sign-on policies. Sign-on policy names should be listed in order of preference, and they must be assigned to the application. For more information, refer to Sign-on policies in the PingOne Platform API Reference.
-
promptAn optional parameter that specifies whether the user is prompted to login for re-authentication. The
promptparameter can be used as a way to check for existing authentication, verifying that the user is still present for the current session.
The authorization request returns a URL to initiate login flow. This authentication flow presents appropriate login forms to an end user and submits data provided by the user for all required sign-on steps. After all login actions in the flow are completed, the GET /{{envID}}/as/resume endpoint continues processing the authorization request.
https://auth.pingone.com/{{envID}}/as/resume?flowId={{flowID}}
After restarting the authorization flow, the authorization code is submitted through a request to the POST /{{envID}}/as/token endpoint to create the access token.
curl --request POST \
--url 'https://auth.pingone.com/{{envID}}/as/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'grant_type=authorization_code&code={{authCode}}&redirect_uri={{redirect_uri}}'
The grant_type, code, and redirect_uri parameter values are required in the request body.
|
The authorization server can issue refresh tokens to web applications that use an |