public async Task UpdateStatus() { if (oauthFetcher.oauth == null || csrfFetcher.csrf == null) { await UpdateTokens(); } statusUrl = WebHandler.getLocalSpotifyUrl("/remote/status.json" + "?oauth=" + oauthFetcher.oauth.t + "&csrf=" + csrfFetcher.csrf.token); status_json = await WebHandler.FetchDataAsync(statusUrl); status = JsonConvert.DeserializeObject <SpotifyStatus>(status_json); // error type 4102 is invalid oauth, 4107 is invalid csrf if (status.isError() && (status.error.type == "4102" || status.error.type == "4107")) { await UpdateTokens(); } }
public async Task UpdateCSRF() { var res = await WebHandler.FetchDataAsync(csrfUrl); csrf = JsonConvert.DeserializeObject <CSRF>(res); }
public CSRFFetcher() { csrfUrl = WebHandler.getLocalSpotifyUrl("/simplecsrf/token.json"); }
public async Task UpdateOAuth() { var res = await WebHandler.FetchDataAsync(oauthUrl); oauth = JsonConvert.DeserializeObject <OAuth>(res); }