C
C#7mo ago
im_blind

Google Token

[HttpPost("google-login")] public async Task<IActionResult> GoogleLogin([FromBody] GoogleUserLoginDTO model) { var payload = await GoogleJsonWebSignature.ValidateAsync(model.Token); var a = payload. if (payload == null) { return BadRequest("Invalid Id Token"); } var user = await _userManager.FindByEmailAsync(payload.Email); if (user == null) { user = new AppUser { Email = payload.Email, UserName = payload.Email, Name = payload.Name, Avatar = payload.Picture, }; var result = await _userManager.CreateAsync(user); if (!result.Succeeded) { return BadRequest("Failed to create user"); } } await _signInManager.SignInAsync(user, isPersistent: false); var token = _tokenService.CreateToken(user); return Ok(new GoogleUserLoginDTO { Token = token }); } quick question, so what im trying to do is to receive a token from google, extract only some of the information (ex: only email and name) and then make another token to send em back to my react buddies. I tested swagger and it returned a normal token just fine. But debugging Front End led to Bad Request 400
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server