exchangeDeviceCodeForToken method

FutureOr<AuthorizationTokenResponse> exchangeDeviceCodeForToken(
  1. Client client,
  2. String? deviceCode,
  3. String state,
  4. RequestContext req,
  5. ResponseContext res,
)

Produces an authorization token from a given device code.

Implementation

FutureOr<AuthorizationTokenResponse> exchangeDeviceCodeForToken(
    Client client,
    String? deviceCode,
    String state,
    RequestContext req,
    ResponseContext res) async {
  var body = await req.parseBody().then((_) => req.bodyAsMap);
  throw AuthorizationException(
    ErrorResponse(
      ErrorResponse.unsupportedResponseType,
      'Device code grants are not supported.',
      body['state']?.toString() ?? '',
    ),
    statusCode: 400,
  );
}