public IActionResult Login() { LoginWithSpotifyModel model = new LoginWithSpotifyModel { ClientId = _configuration.GetValue <string>("Spotify:ClientId"), RedirectUrl = _configuration.GetValue <string>("Spotify:RedirectUrl"), SpotifyAuthenticationUrl = _configuration.GetValue <string>("Spotify:AuthenticationUrl"), SpaceDelimitedScopes = _configuration.GetValue <string>("Spotify:Scopes") }; return(Redirect(CreateSpotifyAuthenicateUrl(model))); }
private string CreateSpotifyAuthenicateUrl(LoginWithSpotifyModel model) { return($"{model.SpotifyAuthenticationUrl}?response_type=code&client_id={model.ClientId}&scope={HttpUtility.UrlEncode(model.SpaceDelimitedScopes)}&redirect_uri={model.RedirectUrl}"); }