private bool RefreshToken() { var successful = false; var client = new RestClient(Constants.Spotify.AccountsBaseApi); var request = new RestRequest("token", Method.POST); request.AddHeader("content-type", "application/x-www-form-urlencoded"); request.AddParameter("application/x-www-form-urlencoded", $"grant_type=refresh_token&refresh_token={credentials.refreshToken}", ParameterType.RequestBody); request.AddHeader("Authorization", "Basic " + CommonUtil.Base64Encode(Constants.Spotify.ClientId + ":" + Constants.Spotify.ClientSecret)); IRestResponse response = client.Execute(request); if (response.IsSuccessful) { successful = true; TokenRefreshResponse refreshResponse = JsonConvert.DeserializeObject <TokenRefreshResponse>(response.Content); credentials.accessToken = refreshResponse.access_token; } return(successful); }