What versions of the api are still working for AuthorizationCodeAuth method
See original GitHub issueHey there,
Just checking out if older version are still working/supported with AuthorizationCodeAuth
method ?
I’m using 4.0.0 .Web and .Web.Auth
It used to work a long time without touching the class and now it stopped working, the api is not able to retrieve to current song, always null
. But the step before still works, I’m still able to authorize the app on my spotify-dev account and get you can close this page now
public SpotifyAPI(string clientId, string secretId, string redirectUrl = "http://localhost:4002")
{
_clientId = clientId;
_secretId = secretId;
if (!string.IsNullOrEmpty(_clientId) && !string.IsNullOrEmpty(_secretId))
{
var auth = new AuthorizationCodeAuth(_clientId, _secretId, redirectUrl, redirectUrl,
Scope.Streaming | Scope.PlaylistReadCollaborative | Scope.UserReadCurrentlyPlaying | Scope.UserReadRecentlyPlayed | Scope.UserReadPlaybackState);
auth.AuthReceived += AuthOnAuthReceived;
auth.Start();
auth.OpenBrowser();
}
}
private async void AuthOnAuthReceived(object sender, AuthorizationCode payload)
{
_authorizationCodeAuth = (AuthorizationCodeAuth)sender;
_authorizationCodeAuth.Stop();
_token = await _authorizationCodeAuth.ExchangeCode(payload.Code);
// remember when to renew the 60 minutes token (10 minutes upfront)
_nextTokenRenewal = DateTimeOffset.UtcNow.AddSeconds(_token.ExpiresIn).AddMinutes(-10);
}
private async Task<SpotifyWebAPI> GetSpotifyWebAPI()
{
if (_token == null) return null;
if (DateTimeOffset.UtcNow >= _nextTokenRenewal)
{
_token = await _authorizationCodeAuth.RefreshToken(_token.RefreshToken);
}
return new SpotifyWebAPI
{
AccessToken = _token.AccessToken,
TokenType = _token.TokenType
};
}
and I use it this way , Item
, is always null
while playing a track.
On spotify-dev website, my app redirectURI
is http://localhost:4002
var api = await GetSpotifyWebAPI();
if (api == null) return false;
var playback = await api.GetPlaybackAsync();
if (playback.HasError() || playback.Item == null)
{
// item always null
}
SpotifyAPI was the reason I needed to upgrade to recent .NET framework and removed support on Vista. Since 4.2.0 is on .NET Standard 2.0, I don’t need to offer support on other platforms or ask user to install more .NET packages to support the SpotifyAPI. I will prefer to remove it at this point and work without it.
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (8 by maintainers)
Yea 90% sure it’s that. If nothing is played, an empty object is sent by the API. Thus, the object has default values.
Yea, super cool that lidarr and even the botframework uses it.
I’m not sure why they shut it down since they didn’t communicate it at all. But I think the local API was a hassle to maintain and buggy as hell, so this could also be the reason for the shutdown.