Fix implicit grant Spotify.Web.Auth example in docs (#465)

The previous example was not functioning due to mistakes and unresolved references, unfortunately. Fixed login request response type, a typo and URI to open in browser. Now it compiles and works properly (tested).
This commit is contained in:
Ilya Burakov 2020-06-20 22:32:34 +05:00 committed by GitHub
parent 7e9bd85d2f
commit a15e71c815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,16 +88,16 @@ public static async Task Main()
_server = new EmbedIOAuthServer(new Uri("http://localhost:5000/callback"), 5000); _server = new EmbedIOAuthServer(new Uri("http://localhost:5000/callback"), 5000);
await _server.Start(); await _server.Start();
_server.ImplictGrantReceived += OnImplictGrantReceived; _server.ImplictGrantReceived += OnImplicitGrantReceived;
var request = new LoginRequest(_server.BaseUri, "ClientId", LoginRequest.ResponseType.Code) var request = new LoginRequest(_server.BaseUri, "ClientId", LoginRequest.ResponseType.Token)
{ {
Scope = new List<string> { Scopes.UserReadEmail } Scope = new List<string> { Scopes.UserReadEmail }
}; };
BrowserUtil.Open(uri); BrowserUtil.Open(request.ToUri());
} }
private static async Task OnImplictGrantReceived(object sender, ImplictGrantResponse response) private static async Task OnImplicitGrantReceived(object sender, ImplictGrantResponse response)
{ {
await _server.Stop(); await _server.Stop();
var spotify = new SpotifyClient(response.AccessToken); var spotify = new SpotifyClient(response.AccessToken);