Ejemplo n.º 1
0
        public IActionResult SignUp([FromRoute] string idToken)
        {
            var userData = _trackingManager.SingIn(idToken);

            if (userData != null)
            {
                userData.Token        = _jwtIssuer.IssueAccessJwt(userData.UserId);
                userData.RefreshToken = _jwtIssuer.IssueRefreshJwt(userData.UserId);
                return(Ok(userData));
            }
            return(BadRequest("Registration failed"));
        }
Ejemplo n.º 2
0
        public IActionResult RefreshToken([FromRoute] string refreshToken)
        {
            var userId = HttpContext.GetUserId();

            if (!_manager.FindUser(userId))
            {
                return(BadRequest("User does not exist"));
            }

            var response = new RefreshModel
            {
                AccessToken  = _jwtIssuer.IssueAccessJwt(userId),
                RefreshToken = _jwtIssuer.IssueRefreshJwt(userId)
            };

            return(Ok(response));
        }