I’m working with the Spotify Android authentication SDK and running into some issues. In the older version (spotify-auth:1.0.0-beta11), there was a simple logout method that worked perfectly:
SpotifyAuth.signOut(appContext);
After upgrading to the current stable release (spotify-android-auth-1.0), this logout function disappeared completely. The official documentation mentions using SpotifyAuth#removeCookies as an alternative, but when I check the actual SDK, this method doesn’t exist either. I can’t find it anywhere in the API documentation.
Does anyone know the proper way to sign out users from their Spotify accounts with the new SDK version? This seems like basic functionality that should be available. Any help would be appreciated!
I hit this same issue during a project migration. Just calling AuthorizationClient.clearCookies(context) won’t cut it for a proper logout. Here’s what actually works: First, call Spotify’s token revocation endpoint. Then clear your local storage and SharedPreferences. Finally, run clearCookies. The tricky bit? Network failures during revocation. I added a fallback that clears local data even when the server call bombs out - otherwise users get stuck half-logged-in. The SDK docs really should explain this since everyone needs it.
had the same issue last month! spotify killed the direct logout, but you can manually clear auth tokens with AuthorizationClient.clearCookies(context) then delete stored access tokens from your app. annoying but it works.
Hit this same issue migrating to the stable SDK. You need AuthorizationClient.clearCookies(context) but that’s not enough - you’ve also got to revoke the auth on Spotify’s servers by calling their revoke endpoint directly. Just clearing local data won’t cut it since the user stays authenticated server-side. I did a two-step logout: hit the revoke endpoint with the current access token, then clear all local auth data (cookies, stored tokens, everything). Skip the server revocation and users will still show as logged in when they reopen the app or use other Spotify apps.
The removeCookies method moved to a different class in the stable release. Use AuthorizationClient.clearCookies(context) instead of the old SpotifyAuth method. Also clear any cached tokens from SharedPreferences or wherever you store them locally. Just clearing cookies wasn’t enough for me - the app kept remembering the user session until I removed the access and refresh tokens from local storage. The docs are pretty outdated on this, took me forever to figure out the right cleanup sequence.
check if you’re calling AuthorizationClient.clearCookies() from the main thread - that was my problem. the method fails silently if not on UI thread and leaves users logged in. wrap it in runOnUiThread() and clear your tokens after
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.