AuthorizationCodeGrant class

A class for obtaining credentials via an authorization code grant.

This method of authorization involves sending the resource owner to the authorization server where they will authorize the client. They're then redirected back to your server, along with an authorization code. This is used to obtain Credentials and create a fully-authorized Client.

To use this class, you must first call getAuthorizationUrl to get the URL to which to redirect the resource owner. Then once they've been redirected back to your application, call handleAuthorizationResponse or handleAuthorizationCode to process the authorization server's response and construct a Client.

Constructors

AuthorizationCodeGrant(String identifier, Uri authorizationEndpoint, Uri tokenEndpoint, {String secret, String delimiter, bool basicAuth: true, Client httpClient, CredentialsRefreshedCallback onCredentialsRefreshed, Map<String, dynamic> getParameters(MediaType contentType, String body), String codeVerifier})
Creates a new grant. [...]

Properties

authorizationEndpoint Uri
A URL provided by the authorization server that serves as the base for the URL that the resource owner will be redirected to to authorize this client. [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
identifier String
The client identifier for this client. [...]
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
secret String
The client secret for this client. [...]
final
tokenEndpoint Uri
A URL provided by the authorization server that this library uses to obtain long-lasting credentials. [...]
final

Methods

close() → void
Closes the grant and frees its resources. [...]
getAuthorizationUrl(Uri redirect, {Iterable<String> scopes, String state}) Uri
Returns the URL to which the resource owner should be redirected to authorize this client. [...]
handleAuthorizationCode(String authorizationCode) Future<Client>
Processes an authorization code directly. [...]
handleAuthorizationResponse(Map<String, String> parameters) Future<Client>
Processes the query parameters added to a redirect from the authorization server. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited