コード例 #1
0
        public ActionResult RefreshToken()
        {
            string           refreshToken    = CustomAuthenticationManager.GetRefreshToken();
            JwtSecurityToken jwtRefreshToken = new JwtSecurityToken(refreshToken);

            return(View(jwtRefreshToken));
        }
コード例 #2
0
        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"));
        }