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.code == 200 || authResult.code == 201) {
    authResult.user = User.create(result.data);

    return authResult;
  } else {
    return authResult;
  }
}