Ejemplo n.º 1
0
        public string RefreshToken(int expireTime, ExternalUser exUser)
        {
            if (exUser == null)
            {
                throw new ArgumentNullException(nameof(exUser));
            }

            var oauthToken = _oAuthProvider.RefreshToken(expireTime: expireTime, identity: exUser.Id.ToString());

            exUser             = _exUserService.GetById(exUser.Id);
            exUser.AccessToken = oauthToken;
            _exUserService.Update(exUser);

            return(exUser.Id.ToString() + oauthToken);
        }
Ejemplo n.º 2
0
 public AccessToken RefreshToken()
 {
     lock (refreshTokenLock)
     {
         try
         {
             Token           = oauthProvider.RefreshToken(Token);
             IsAuthenticated = true; //just in case (ex. this failed previously (sets to false), but we retry later with same token.)
             return(Token);
         }
         catch (Exception ex)
         {
             Console.WriteLine("Unable to refresh Token: " + ex.Message);
             IsAuthenticated = false;
             throw; // rethrow the exception
         }
     }
 }