restoreAuthenticatedInstance static method

Reddit restoreAuthenticatedInstance(
  1. String credentialsJson, {
  2. String? clientId,
  3. String? clientSecret,
  4. String? userAgent,
  5. Uri? redirectUri,
  6. Uri? tokenEndpoint,
  7. Uri? authEndpoint,
  8. Uri? configUri,
  9. String siteName = 'default',
})

Creates a new Reddit instance for use with the web authentication flow. This instance is not authenticated until a valid response code is provided to WebAuthenticator.authorize (see test/auth/web_auth.dart for an example usage).

clientId is the identifier associated with your authorized application on Reddit. To get a client ID, create an authorized application here.

userAgent is an arbitrary identifier used by the Reddit API to differentiate between client instances. This should be relatively unique.

redirectUri is the redirect URI associated with your Reddit application.

tokenEndpoint is a Uri to an alternative token endpoint. If not provided, defaultTokenEndpoint is used.

authEndpoint is a Uri to an alternative authentication endpoint. If not provided, defaultAuthTokenEndpoint is used.

configUri is a Uri pointing to a 'draw.ini' file, which can be used to populate the previously described parameters.

siteName is the name of the configuration to use from draw.ini. Defaults to 'default'.

Implementation

static Reddit restoreAuthenticatedInstance(String credentialsJson,
    {String? clientId,
    String? clientSecret,
    String? userAgent,
    Uri? redirectUri,
    Uri? tokenEndpoint,
    Uri? authEndpoint,
    Uri? configUri,
    String siteName = 'default'}) {
  return Reddit._webFlowInstanceRestore(
      clientId,
      clientSecret,
      userAgent,
      credentialsJson,
      redirectUri,
      tokenEndpoint,
      authEndpoint,
      configUri,
      siteName);
}