public async Task <IActionResult> Redirect([FromQuery][Required] string code, [FromQuery][Required] string state, [FromQuery] string?error = null) { if (!string.IsNullOrEmpty(error)) { return(LocalRedirect($"/#error={error}")); } string accessToken = await spotifyClient.RequestAccessToken(code); var profile = await spotifyClient.GetCurrentUserProfile(); UserInfo userInfo = new UserInfo() { UserId = profile.Id, State = state }; await cosmosAPI.SaveUserInfo(userInfo); return(LocalRedirect($"/#accessToken={accessToken}&state={state}")); }