public IActionResult CreateUserToken([FromBody] UserTokenCreateModel model) { if (model == null) { return(Ok(BaseResponse <string> .BadRequest())); } var result = _userTokenService.Create(model.AccessToken, model.ReturnUrl); return(Ok(result)); }
public async Task <(string Token, DateTime ExpirationTime)> SignIn(long userId, string password) { var user = await userService.Get(userId); if (user == null) { throw new ServiceException(AppErrors.EntityDoesNotExists); } if (!passwordService.VerifyHashedPassword(user.Password, user.Salt, password)) { throw new ServiceException(AppErrors.BadLoginError); } var(token, expirationTime) = jwtTokenIssuer.IssueToken(user.Id); await userTokenService.Create(new UserTokenModel { Expiration = expirationTime, Token = token, UserIdentityId = user.Id }); return(token, expirationTime); }