Oauth2 class

The OAuth2 service allows you to authorize apps and issue standards-based OAuth2 and OpenID Connect tokens.

Constructors

Oauth2(Client client)

Properties

client Client
finalinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

approve({required String grantId, String? authorizationDetails, String? scope}) Future<Oauth2Approve>
Approve an OAuth2 grant after the user gives consent. Returns the redirectUrl the end user should be sent to. The consent screen may optionally pass enriched authorization_details to record the concrete resources the user selected. You can pass Accept header of application/json to receive a JSON response instead of a redirect.
authorize({String? clientId, String? redirectUri, String? responseType, String? scope, String? state, String? nonce, String? codeChallenge, String? codeChallengeMethod, String? prompt, int? maxAge, String? authorizationDetails, String? resource, String? audience, String? requestUri}) Future<Oauth2Authorize>
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/json to receive a JSON response instead of a redirect.
authorizePost({String? clientId, String? redirectUri, String? responseType, String? scope, String? state, String? nonce, String? codeChallenge, String? codeChallengeMethod, String? prompt, int? maxAge, String? authorizationDetails, String? resource, String? audience, String? requestUri}) Future<Oauth2Authorize>
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/json to 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 organization authorization 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 project authorization 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 redirectUrl the end user should be sent to with an access_denied error. You can pass Accept header of application/json to 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