mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 06:56:27 +00:00
Merge pull request #135 from henningms/master
#134 Adds User-Agent in the OAuth request due to recent changes in th…
This commit is contained in:
commit
7ed7966c16
@ -60,7 +60,7 @@ namespace SpotifyAPI.Local
|
|||||||
internal string GetOAuthKey()
|
internal string GetOAuthKey()
|
||||||
{
|
{
|
||||||
string raw;
|
string raw;
|
||||||
using (WebClient wc = new WebClient())
|
using (WebClient wc = GetWebClientWithUserAgentHeader())
|
||||||
{
|
{
|
||||||
raw = wc.DownloadString("http://open.spotify.com/token");
|
raw = wc.DownloadString("http://open.spotify.com/token");
|
||||||
}
|
}
|
||||||
@ -166,5 +166,14 @@ namespace SpotifyAPI.Local
|
|||||||
{
|
{
|
||||||
return Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds);
|
return Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal WebClient GetWebClientWithUserAgentHeader()
|
||||||
|
{
|
||||||
|
var wc = new WebClient();
|
||||||
|
|
||||||
|
wc.Headers.Add(HttpRequestHeader.UserAgent, "Spotify (1.0.50.41368.gbd68dbef)");
|
||||||
|
|
||||||
|
return wc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user