Ejemplo n.º 1
0
        public async Task <IActionResult> ExchangeTokens(ExchangeTokensRequest exchangeTokensRequest)
        {
            var exchangeTokensResult = await _mediator.Send(new ExchangeTokensCommand
            {
                RefreshToken    = exchangeTokensRequest.RefreshToken,
                AccessToken     = exchangeTokensRequest.AccessToken,
                RemoteIpAddress = HttpContext.Connection.RemoteIpAddress.ToString()
            });

            return(Ok(exchangeTokensResult));
        }
Ejemplo n.º 2
0
        public async Task <Result <AuthenticationTokens> > Handle(ExchangeTokensRequest request, CancellationToken cancellationToken)
        {
            var result = await tokenService.ExchangeAuthenticationTokensAsync((AuthenticationTokens)request);  // explicit conversion operator

            if (!result.Succeeded)
            {
                logger.LogError("ExchangeTokenHandler. Exchaning auth tokens failed. Request tokens {@tokens}, errors {@errors}",
                                request, result.Errors);
            }

            return(result);
        }