resourceOwnerPasswordCredentialsGrant method

FutureOr<AuthorizationTokenResponse> resourceOwnerPasswordCredentialsGrant(
  1. Client? client,
  2. String? username,
  3. String? password,
  4. Iterable<String> scopes,
  5. RequestContext req,
  6. ResponseContext res,
)

Issue an authorization token to a user after authenticating them via username and password.

Implementation

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