getNewAccessTokenByRefreshToken static method

Future<AuthResult> getNewAccessTokenByRefreshToken(
  1. String refreshToken
)

Refresh Access Token

Implementation

static Future<AuthResult> getNewAccessTokenByRefreshToken(
    String refreshToken) async {
  String url = "https://" + Util.getHost(Authing.config) + "/oidc/token";
  String body = "client_id=" +
      Authing.sAppId +
      "&grant_type=refresh_token" +
      "&refresh_token=" +
      refreshToken;

  Result result = await oauthRequest("post", url, body);

  AuthResult authResult = AuthResult(result);

  if (authResult.statusCode == 200 || authResult.statusCode == 201) {
    authResult.user = User.create(result.data);

    return authResult;
  } else {
    return authResult;
  }
}