public ActionResult RefreshToken() { string refreshToken = CustomAuthenticationManager.GetRefreshToken(); JwtSecurityToken jwtRefreshToken = new JwtSecurityToken(refreshToken); return(View(jwtRefreshToken)); }
public ActionResult RefreshAccessToken() { string refreshToken = CustomAuthenticationManager.GetRefreshToken(); ClientCredential credential = new ClientCredential(DemoConstants.ClientId, DemoConstants.ClientSecret); string resource = DemoConstants.TargetResource; AuthenticationContext authenticationContext = new AuthenticationContext(DemoConstants.urlAuthorizationEndpoint); AuthenticationResult authenticationResult = authenticationContext.AcquireTokenByRefreshToken(refreshToken, credential, resource); CustomAuthenticationManager.RefreshAccessToken(authenticationResult); return(RedirectToAction("AccessToken", "TokenViewer")); }