restoreInstalledAuthenticatedInstance static method

Reddit restoreInstalledAuthenticatedInstance(
  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 installed Reddit instance from cached credentials.

credentialsJson is a json string containing the cached credentials. This parameter is required and cannot be 'null'.

This string can be retrieved from an installed Reddit instance in the following manner:

final credentialsJson = reddit.auth.credentials.toJson();

clientId is the identifier associated with your installed application on Reddit. To get a client ID, create an installed 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 restoreInstalledAuthenticatedInstance(String credentialsJson,
    {String? clientId,
    String? clientSecret,
    String? userAgent,
    Uri? redirectUri,
    Uri? tokenEndpoint,
    Uri? authEndpoint,
    Uri? configUri,
    String siteName = 'default'}) {
  return Reddit._webFlowInstanceRestore(
      clientId,
      '',
      userAgent,
      credentialsJson,
      redirectUri,
      tokenEndpoint,
      authEndpoint,
      configUri,
      siteName);
}