Skip to content

Commit 7ed7966

Browse files
authored
Merge pull request #135 from henningms/master
#134 Adds User-Agent in the OAuth request due to recent changes in th…
2 parents 3ebb446 + ba03526 commit 7ed7966

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

SpotifyAPI/Local/RemoteHandler.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ internal StatusResponse GetNewStatus()
6060
internal string GetOAuthKey()
6161
{
6262
string raw;
63-
using (WebClient wc = new WebClient())
63+
using (WebClient wc = GetWebClientWithUserAgentHeader())
6464
{
6565
raw = wc.DownloadString("http://open.spotify.com/token");
6666
}
@@ -166,5 +166,14 @@ internal int GetTimestamp()
166166
{
167167
return Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds);
168168
}
169+
170+
internal WebClient GetWebClientWithUserAgentHeader()
171+
{
172+
var wc = new WebClient();
173+
174+
wc.Headers.Add(HttpRequestHeader.UserAgent, "Spotify (1.0.50.41368.gbd68dbef)");
175+
176+
return wc;
177+
}
169178
}
170179
}

0 commit comments

Comments
 (0)