예제 #1
0
    public static AuthorizationCodeWebApp.AuthResult checkExpiration(Controller controller, AuthorizationCodeWebApp.AuthResult authorization)
    {
        if (authorization.Credential.Token.IsExpired(Google.Apis.Util.SystemClock.Default))
        {
            Google.Apis.Auth.OAuth2.Responses.TokenResponse token = new Google.Apis.Auth.OAuth2.Responses.TokenResponse();
            //recreate the token
            token = authorization.Credential.Flow.RefreshTokenAsync(
                UserAccountsController.getUserId(controller.Session).ToString(),
                authorization.Credential.Token.RefreshToken,
                CancellationToken.None
                ).Result;

            authorization = getAuthorization(controller);
        }
        return(authorization);
    }
예제 #2
0
 public override string GetUserId(Controller controller)
 {
     return(UserAccountsController.getUserId(controller.Session).ToString());
 }