clientCredentialsGrant method

FutureOr<AuthorizationTokenResponse> clientCredentialsGrant(
  1. Client? client,
  2. RequestContext req,
  3. ResponseContext res
)

Performs a client credentials grant. Only use this in situations where the client is 100% trusted.

Implementation

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