SpotifyAPI-NET
SpotifyAPI-NET copied to clipboard
AutorizationCodeAuth causes "savehandle has been closed" exception
the following code taken from the spotifyWebApi documentation has a ~20% chance to crash
private static void auth_OnResponseReceivedEvent(AutorizationCodeAuthResponse response)
{
//Stop the HTTP Server, done.
auth.StopHttpServer();
//NEVER DO THIS! You would need to provide the ClientSecret.
//You would need to do it e.g via a PHP-Script.
Token token = auth.ExchangeAuthCode(response.Code, "XXXXXXXXXXX");
var spotify = new SpotifyWebApiClass()
{
TokenType = token.TokenType,
AccessToken = token.AccessToken
};
//With the token object, you can now make API calls
}
Putting the line
auth.StopHttpServer();
at the end of the function fixes the problem.
Reordered docs in dcf4eefc619470e6b28a159ab27a021eaa47d981
The internal HTTP-Server is still very unstable and needs a new implementation, so don't expect too much.