public async Task <IActionResult> Authorized(string code) { try { PartyGoer newUser = await _authenticationService.AuthenticateUserWithAccessCodeAsync(code); if (!newUser.HasPremium()) { // TODO: create this return(RedirectToAction("NoPremium", "Error")); } // Get details from spotify of user var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme); identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, newUser.GetId())); var principal = new ClaimsPrincipal(identity); await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal); await _logService.LogUserActivityAsync(newUser, "Successfully authenticated through Spotify"); return(RedirectToAction("App", "Party")); } catch (Exception) { // TODO: CHANGE THIS TO THE IDNEX PAGE ON HOME return(RedirectToAction("App", "Party")); } }