WebAuthenticator class

The WebAuthenticator class allows for the creation of an Authenticator that exposes functionality which allows for the user to authenticate through a browser. The url method is used to generate the URL that the user uses to authenticate on www.reddit.com, and the authorize method retrieves the access token given the returned code. This is to be used with the 'Web' app type credentials. Refer to Reddit's documentation for descriptions of valid app types.

Inheritance

Properties

credentials → Credentials
The credentials associated with this authenticator instance.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isValid bool
A flag representing whether or not this authenticator instance is valid.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
userAgent String
The user agent value to be presented to Reddit.
no setterinherited

Methods

authorize(String code) Future<void>
Authorizes the current Authenticator instance using the code returned from Reddit after the user has authenticated.
override
delete(Uri path, {Map<String, String>? body}) Future
Make a simple DELETE request.
inherited
get(Uri path, {Map<String, String?>? params, bool followRedirects = false}) Future
Make a simple GET request.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post(Uri path, Map<String, String?>? body, {Map<String, Uint8List?>? files, Map? params}) Future
Make a simple POST request.
inherited
put(Uri path, {Map<String, String>? body}) Future
Make a simple PUT request.
inherited
refresh() Future<void>
Request a new access token from the Reddit API. Throws a DRAWAuthenticationError if the Authenticator is not yet initialized.
override
revoke() Future<void>
Revokes any outstanding tokens associated with the Authenticator.
inherited
toString() String
A string representation of this object.
inherited
url(List<String> scopes, String state, {String duration = 'permanent', bool compactLogin = false}) Uri
Generates the authentication URL used for Reddit user verification in a browser.
override

Operators

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

Static Methods

create(DRAWConfigContext config, AuthorizationCodeGrant grant) WebAuthenticator
restore(DRAWConfigContext config, String credentialsJson) WebAuthenticator