Device Flow

Process Device Authorization Request

This API parses request parameters of a device authorization request and returns necessary data for the authorization server implementation to process the device authorization request further.

Description

This API is supposed to be called from the within the implementation of the device authorization endpoint of the service. The service implementation should retrieve the value of action from the response and take the following steps according to the value. INTERNAL_SERVER_ERROR When the value of action is INTERNAL\_SERVER\_ERROR, it means that the API call from the authorization server implementation was wrong or that an error occurred in Authlete. In either case, from a viewpoint of the client application, it is an error on the server side. Therefore, the authorization server implementation should generate a response to the client application with "500 Internal Server Error"s and application/json. The value of responseContent is a JSON string which describes t he error, so it can be used as the entity body of the response. The following illustrates the response which the authorization server implementation should generate and return to the client application.

HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
{responseContent}

BAD_REQUEST When the value of action is BAD\_REQUEST, it means that the request from the client application is wrong. The authorization server implementation should generate a response to the client application with "400 Bad Request" and application/json. The value of responseContent is a JSON string which describes the error, so it can be used as the entity body of the response. The following illustrates the response which the service implementation should generate and return to the client application.

HTTP/1.1 400 Bad Request
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
{responseContent}

UNAUTHORIZED When the value of action is UNAUTHORIZED, it means that client authentication of the device authorization request failed. The authorization server implementation should generate a response to the client application with "401 Unauthorized" and application/json. The value of responseContent is a JSON string which describes the error, so it can be used as the entity body of the response. The following illustrates the response which the service implementation must generate and return to the client application.

HTTP/1.1 401 Unauthorized
WWW-Authenticate: (challenge)
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
{responseContent}

OK When the value of action is OK, it means that the device authorization request from the client application is valid. The authorization server implementation should generate a response to the client application with "200 OK" and application/json. The responseContent is a JSON string which can be used as the entity body of the response. The following illustrates the response which the authorization server implementation should generate and return to the client application.

post/api/{serviceId}/device/authorization

Path parameters

serviceIdstring required

A service ID.

Request body

parametersstring required

Parameters of a device authorization request which are the request parameters that the device authorization endpoint of the authorization server implementation received from the client application.

The value of parameters is the entire entity body (which is formatted in application/x-www-form-urlencoded) of the request from the client application.

clientIdstring

The client ID extracted from Authorization header of the device authorization request from the client application.

If the device authorization endpoint of the authorization server implementation supports Basic Authentication as a means of client authentication, and the request from the client application contained its client ID in Authorization header, the value should be extracted and set to this parameter.

clientSecretstring

The client secret extracted from Authorization header of the device authorization request from the client application.

If the device authorization endpoint of the authorization server implementation supports Basic Authentication as a means of client authentication, and the request from the client application contained its client secret in Authorization header, the value should be extracted and set to this parameter.

clientCertificatestring

The client certificate used in the TLS connection between the client application and the device authorization endpoint of the authorization server.

clientCertificatePathstring[]

The client certificate path presented by the client during client authentication. Each element is a string in PEM format.

oauthClientAttestationstring

The value of the OAuth-Client-Attestation HTTP header, which is defined in the specification of OAuth 2.0 Attestation-Based Client Authentication.

oauthClientAttestationPopstring

The value of the OAuth-Client-Attestation-PoP HTTP header, which is defined in the specification of OAuth 2.0 Attestation-Based Client Authentication.

Response

resultCodestring

The code which represents the result of the API call.

resultMessagestring

A short message which explains the result of the API call.

action'INTERNAL_SERVER_ERROR' | 'BAD_REQUEST' | 'UNAUTHORIZED' | 'OK'

The next action that the authorization server implementation should take.

responseContentstring

The content that the authorization server implementation is to return to the client application. Its format varies depending on the value of action parameter.

clientIdinteger

The client ID of the client application that has made the device authorization request.

clientIdAliasstring

The client ID alias of the client application that has made the device authorization request.

clientIdAliasUsedboolean

true if the value of the client_id request parameter included in the device authorization request is the client ID alias. false if the value is the original numeric client ID.

clientNamestring

The name of the client application which has made the device authorization request.

clientAuthMethodstring

The client authentication method that should be performed at the device authorization endpoint.

claimNamesstring[]

The names of the claims which were requested indirectly via some special scopes. See 5.4. Requesting Claims using Scope Values in OpenID Connect Core 1.0 for details.

acrsstring[]

The list of ACR values requested by the device authorization request.

Basically, this property holds the value of the acr_values request parameter in the device authorization request. However, because unsupported ACR values are dropped on Authlete side, if the acr_values request parameter contains unrecognized ACR values, the list returned by this property becomes different from the value of the acr_values request parameter.

deviceCodestring

The device verification code. This corresponds to the device_code property in the response to the client.

userCodestring

The end-user verification code. This corresponds to the user_code property in the response to the client.

verificationUristring

The end-user verification URI. This corresponds to the verification_uri property in the response to the client.

verificationUriCompletestring

The end-user verification URI that includes the end-user verification code. This corresponds to the verification_uri_complete property in the response to the client.

expiresIninteger

The duration of the device verification code in seconds. This corresponds to the expires_in property in the response to the client.

intervalinteger

The minimum amount of time in seconds that the client must wait for between polling requests to the token endpoint. This corresponds to the interval property in the response to the client.

warningsstring[]

The warnings raised during processing the backchannel authentication request.

resourcesstring[]

The resources specified by the resource request parameters. See "Resource Indicators for OAuth 2.0" for details.

gmAction'CREATE' | 'QUERY' | 'REPLACE' | 'REVOKE' | 'MERGE'

The grant management action of the device authorization request.

The grant_management_action request parameter is defined in Grant Management for OAuth 2.0.

grantIdstring

the value of the grant_id request parameter of the device authorization request.

The grant_id request parameter is defined in Grant Management for OAuth 2.0 , which is supported by Authlete 2.3 and newer versions.

grantSubjectstring

The subject identifying the user who has given the grant identified by the grant\_id request parameter of the device authorization request. Authlete 2.3 and newer versions support Grant Management for OAuth 2.0. An authorization request may contain a grant\_id request parameter which is defined in the specification. If the value of the request parameter is valid, {@link #getGrantSubject()} will return the subject of the user who has given the grant to the client application. Authorization server implementations may use the value returned from {@link #getGrantSubject()} in order to determine the user to authenticate. The user your system will authenticate during the authorization process (or has already authenticated) may be different from the user of the grant. The first implementer's draft of "Grant Management for OAuth 2.0" does not mention anything about the case, so the behavior in the case is left to implementations. Authlete will not perform the grant management action when the subject passed to Authlete does not match the user of the grant.

clientEntityIdstring

The entity ID of the client.

clientEntityIdUsedboolean

Flag which indicates whether the entity ID of the client was used when the request for the access token was made.

metadataDocumentLocationstring uri

The location of the client's metadata document that was used to resolve client metadata.

This property is set when client metadata was retrieved via the OAuth Client ID Metadata Document (CIMD) mechanism.

metadataDocumentUsedboolean

Flag indicating whether a metadata document was used to resolve client metadata for this request.

When true, the client metadata was retrieved via the CIMD mechanism rather than from the Authlete database.

Changes