public SpotifyService(IClient webClient, ITrackRepository trackRepository, IGenreRepository genreRepository) { _urlToken = "https://accounts.spotify.com/api/token"; _authentication = new SpotifyAuthentication("b1147fe5ecdf4407a778d5af85728d6b", "5b7a0f78a40141779d0ec3421b00e913", "Bearer"); _webClient = webClient; _trackRepository = trackRepository; _genreRepository = genreRepository; }
public SpotifyAuthentication GenerateAuthentication() { var auth = new SpotifyAuthentication { ClientId = clientId, ClientSecret = clientSecret }; return(auth); }
public Spotify(IConfiguration config) { _config = config; SpotifyAuthentication token = new SpotifyAuthentication(_config); var bearer = JsonConvert.DeserializeObject <Dictionary <string, string> >(token.GetClientCredentialsAuthToken()); _api = new SpotifyWebAPI { AccessToken = bearer["access_token"], TokenType = bearer["token_type"] }; }
public SpotifySortWorker(ILogger <SpotifySortWorker> logger, IOptions <SpotifySortOptions> sortOptions, IOptions <SpotifyAuthentication> authOptions, ISpotifySort sorter, IServiceScopeFactory scopeFactory) { this.logger = logger; this.sortOptions = sortOptions.Value; this.authOptions = authOptions.Value; this.sorter = sorter; this.localIp = this.authOptions.CallbackIp; this.semaphore = new SemaphoreSlim(1, 1); this.scopeFactory = scopeFactory; }
public IActionResult OnGet() { AuthenticationObject = _context.AuthenticationObjects.FirstOrDefault(); if (AuthenticationObject != null) { return(RedirectToPage("../PlaylistRequest/Create")); } if (!string.IsNullOrEmpty(code)) { if (AuthenticationObject == null) { SpotifyAuthentication.ExchangeCodeForToken(code, _context); } return(RedirectToPage("../PlaylistRequest/Create")); } return(Page()); }
public void OnPost() { var authTokenUrl = SpotifyAuthentication.GetAuthenticationTokenURL(); Response.Redirect(authTokenUrl); }