Ejemplo n.º 1
0
        public async Task <ActionResult> TokenExchange()
        {
            var cp            = (ClaimsPrincipal)User;
            var at            = cp.FindFirst("access_token").Value;
            var tokenResponse = await _client.TokenExchange(at);

            if (!tokenResponse.IsError)
            {
                ViewBag.Token = tokenResponse.AccessToken;
                ViewBag.Jwt   = tokenResponse.AccessToken.DecodeToken();

                return(View());
            }

            ViewData["Error"] = tokenResponse.Error;
            return(View("Error"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> TokenExchange()
        {
            var at = await HttpContext.GetTokenAsync("access_token");

            var tokenResponse = await _client.TokenExchange(at);

            if (!tokenResponse.IsError)
            {
                ViewBag.Token = tokenResponse.AccessToken;
                ViewBag.Jwt   = tokenResponse.AccessToken.DecodeToken();

                return(View());
            }

            ViewData["Error"] = tokenResponse.Error;
            return(View("Error"));
        }