mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 23:16:28 +00:00
Fix example
This commit is contained in:
parent
3b7fc1a203
commit
18863f1733
@ -25,9 +25,17 @@ namespace SpotifyAPI.Web.Example
|
|||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
"Tip: If you want to supply your ClientID and SecretId beforehand, use env variables (SPOTIFY_CLIENT_ID and SPOTIFY_SECRET_ID)");
|
"Tip: If you want to supply your ClientID and SecretId beforehand, use env variables (SPOTIFY_CLIENT_ID and SPOTIFY_SECRET_ID)");
|
||||||
|
|
||||||
CredentialsAuth auth = new CredentialsAuth(_clientId, _secretId);
|
AuthorizationCodeAuth auth =
|
||||||
Token token = await auth.GetToken();
|
new AuthorizationCodeAuth(_clientId, _secretId, "http://localhost:4002", "http://localhost:4002",
|
||||||
SpotifyWebAPI api = new SpotifyWebAPI() { TokenType = token.TokenType, AccessToken = token.AccessToken};
|
Scope.PlaylistReadPrivate | Scope.PlaylistReadCollaborative);
|
||||||
|
auth.AuthReceived += async (sender, payload) =>
|
||||||
|
{
|
||||||
|
auth.Stop();
|
||||||
|
Token token = await auth.ExchangeCode(payload.Code);
|
||||||
|
SpotifyWebAPI api = new SpotifyWebAPI() {TokenType = token.TokenType, AccessToken = token.AccessToken};
|
||||||
|
};
|
||||||
|
auth.Start();
|
||||||
|
auth.OpenBrowser();
|
||||||
|
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
auth.Stop(0);
|
auth.Stop(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user