getAuthorizationDetails method

Future<OAuthAuthorizationResponse> getAuthorizationDetails(
  1. String authorizationId
)

Retrieves details about an OAuth authorization request. Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.

Returns an OAuthAuthorizationDetailsResponse with the client info, scopes and user information when the user still has to consent. When the user already granted consent to this client, the server short-circuits the flow and an OAuthAuthorizationRedirectResponse carrying the redirect URL is returned instead. Switch on the sealed OAuthAuthorizationResponse to handle both cases.

Implementation

Future<OAuthAuthorizationResponse> getAuthorizationDetails(
  String authorizationId,
) async {
  final session = _client.currentSession;

  final data = await _fetch.request(
    '${_client._url}/oauth/authorizations/$authorizationId',
    RequestMethodType.get,
    options: GotrueRequestOptions(
      headers: _client._headers,
      jwt: session?.accessToken,
    ),
  );

  return OAuthAuthorizationResponse.fromJson(data);
}