mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
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:
parent
7e9bd85d2f
commit
a15e71c815
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user