Fix example

This commit is contained in:
Jonas Dellinger 2018-12-22 21:15:29 +01:00
parent 3b7fc1a203
commit 18863f1733

View File

@ -24,11 +24,19 @@ namespace SpotifyAPI.Web.Example
Console.WriteLine("This example uses AuthorizationCodeAuth."); Console.WriteLine("This example uses AuthorizationCodeAuth.");
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);
} }