mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 06:56:27 +00:00
Fix example
This commit is contained in:
parent
3b7fc1a203
commit
18863f1733
@ -25,9 +25,17 @@ namespace SpotifyAPI.Web.Example
|
||||
Console.WriteLine(
|
||||
"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);
|
||||
Token token = await auth.GetToken();
|
||||
AuthorizationCodeAuth auth =
|
||||
new AuthorizationCodeAuth(_clientId, _secretId, "http://localhost:4002", "http://localhost:4002",
|
||||
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();
|
||||
auth.Stop(0);
|
||||
|
Loading…
Reference in New Issue
Block a user