public async Task <IActionResult> Landing() { var queryStrings = HttpContext.Request.Query; if (queryStrings.TryGetValue("error", out var error)) { _logger.Information($"error:{error}"); return(BadRequest(error)); } _playlistManager.Session = await _spotify.Authenticate(new AuthorizationResponse { Code = queryStrings["code"], State = queryStrings["state"] }, _playlistManager.Hmac); _playlistManager.Me = await _spotify.Get <MeResponse>(SpotifyApi.Me, _playlistManager.Token); return(new OkObjectResult(_playlistManager.Me)); }
private async Task <bool> InitiateSpotify() { // lets get the settings out await this.settingsProvider.ReadSettings(); // lets now authenticate var success = true; try { await webApi.Authenticate(); } catch (SpotifyWebApiException e) { this.logger.Error(e, "Unable to Authenticate with Spotify"); success = false; } return(success); }