getAuthorizationPage method

  1. @Operation()
Future<Response> getAuthorizationPage({
  1. @Bind("scope") String? scope,
})

Returns an HTML login form.

A client that wishes to authenticate with this server should direct the user to this page. The user will enter their username and password that is sent as a POST request to this same controller.

The 'client_id' must be a registered, valid client of this server. The client must also provide a state to this request and verify that the redirect contains the same value in its query string.

Implementation

@Operation.get()
Future<Response> getAuthorizationPage({
  /// A space-delimited list of access scopes to be requested by the form submission on the returned page.
  @Bind.query("scope") String? scope,
}) async {
  if (clientID == null) {
    return Response.badRequest();
  }

  if (delegate == null) {
    return Response(405, {}, null);
  }

  final renderedPage = await delegate!
      .render(this, request!.raw.uri, responseType, clientID!, state, scope);

  return Response.ok(renderedPage)..contentType = ContentType.html;
}