public async Task <IActionResult> GetUserAuthenticationToken([FromBody] UserAuthTokenRequest request)
        {
            (string errorMessage, string token) = await mediator.Send(request);

            if (token is null)
            {
                return(BadRequest(new BadRequestResponse(errorMessage)));
            }

            return(Ok(new TokenReponse(token)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取UserAccessToken
        /// </summary>
        /// <returns></returns>
        public async Task <AllegroResult <AuthTokenResponse> > GetTokenUserAsync(string code)
        {
            var request = new UserAuthTokenRequest(new UserAuthTokenRequestParameter {
                Code = code
            });

            request.Request = RequestEnum.User;

            var res = await _client.GetAsync(request);

            //根据用户Id 写入UserToken
            _redis.StringSet("AllegroUserToken", res.Result.access_token);

            return(res);
        }