public Task RedirectToGiveToken(CustomerLoginStateContext context) { var currentUrl = $"Login/CreateToken?key={context.SessionInfoKey}"; context.HttpContext.Response.Redirect(currentUrl); return(Task.CompletedTask); }
public async Task CreateToken(CustomerLoginStateContext context) { var associateUserService = context.HttpContext.RequestServices.GetService <AssociateWeChatUser>(); if (context.ErrCode != null && !context.ErrCode.Equals("0")) { throw new Exception(context.ErrMsg); } var jwtToken = associateUserService.GetUserToken(context.OpenId); var response = context.HttpContext.Response; await response.WriteAsync(jwtToken); }