Oauth2 class
The OAuth2 service allows you to authorize apps and issue standards-based OAuth2 and OpenID Connect tokens.
Properties
Methods
-
approve(
{required String grantId, String? authorizationDetails, String? scope}) → Future< Oauth2Approve> -
Approve an OAuth2 grant after the user gives consent. Returns the
redirectUrlthe end user should be sent to. The consent screen may optionally pass enrichedauthorization_detailsto record the concrete resources the user selected. You can pass Accept header ofapplication/jsonto receive a JSON response instead of a redirect. -
Begin the OAuth2 authorization flow. When called without a session, the
user is redirected to the consent screen without grant ID. When called with
a session, the redirect URL includes param for grant ID. You can pass
Accept header of
application/jsonto receive a JSON response instead of a redirect. -
Begin the OAuth2 authorization flow. When called without a session, the
user is redirected to the consent screen without grant ID. When called with
a session, the redirect URL includes param for grant ID. You can pass
Accept header of
application/jsonto receive a JSON response instead of a redirect. -
createDeviceAuthorization(
{String? clientId, String? scope, String? authorizationDetails, String? resource, String? audience}) → Future< Oauth2DeviceAuthorization> - Start the OAuth2 Device Authorization Grant. Returns the device code, user code, verification URL, expiration, and polling interval.
-
createGrant(
{required String userCode}) → Future< Oauth2Grant> - Exchange a device flow user code for an OAuth2 grant. The authenticated user is bound to the pending grant. Pass the returned grant ID to the get grant endpoint to render the consent screen, then to the approve or reject endpoint to complete the flow.
-
createPAR(
{required String clientId, required String redirectUri, required String responseType, String? scope, String? state, String? nonce, String? codeChallenge, String? codeChallengeMethod, String? prompt, int? maxAge, String? authorizationDetails, String? resource, String? audience}) → Future< Oauth2PAR> - Store an OAuth2 authorization request server-side and receive a short-lived request_uri handle for the authorize endpoint.
-
createToken(
{required String grantType, String? code, String? refreshToken, String? deviceCode, String? clientId, String? clientSecret, String? codeVerifier, String? redirectUri, String? resource, String? audience}) → Future< Oauth2Token> - Exchange an OAuth2 authorization code, refresh token, or device code for access and refresh tokens.
-
getGrant(
{required String grantId}) → Future< Oauth2Grant> - Get an OAuth2 grant by its ID. Used by the consent screen to display the details of the authorization the user is being asked to approve. A grant can only be read by the user it belongs to, or by server SDK.
-
listOrganizations(
{int? limit, int? offset, String? search}) → Future< Oauth2OrganizationList> -
List the organizations the OAuth2 access token can access. Resolves the
token's
organizationauthorization details, expanding the*wildcard into the concrete set of organizations the user can see. -
listProjects(
{int? limit, int? offset, String? search}) → Future< Oauth2ProjectList> -
List the projects the OAuth2 access token can access. Resolves the token's
projectauthorization details, expanding the*wildcard into the concrete set of projects the user can see. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reject(
{required String grantId}) → Future< Oauth2Reject> -
Reject an OAuth2 grant when the user denies consent. Returns the
redirectUrlthe end user should be sent to with anaccess_deniederror. You can pass Accept header ofapplication/jsonto receive a JSON response instead of a redirect. -
revoke(
{required String token, String? tokenTypeHint, String? clientId, String? clientSecret}) → Future - Revoke an OAuth2 access token or refresh token.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited