Issue with Spotify Authentication SDK logout feature
I’m working with the Spotify Authentication SDK and ran into a problem after upgrading versions. In the older beta version (spotify-auth:1.0.0-beta11), there was a simple logout method available:
SpotifyAuth.signOut(appContext);
After I updated to the stable release (spotify-android-auth-1.0), this logout function disappeared completely. The official documentation mentions using something like SpotifyAuth.removeCookies as an alternative, but when I check my SDK installation, this method doesn’t exist either.
I’ve looked through the current API documentation but can’t find any working solution for logging users out of their Spotify accounts. This is causing issues in my app because users can’t properly sign out and switch accounts.
Does anyone know the correct way to implement logout functionality with the current version of the Spotify Android SDK? Is there a workaround or will the logout method be added back in future updates?
Hit this same issue during a production deploy last year. The stable SDK just yanked the logout method without documenting alternatives - super frustrating. Here’s what worked for me: manually clear the authorization response data and force a fresh auth flow. You’ve got to wipe both the stored access tokens and any cached user data in your app’s local storage. When users try to authenticate again, initialize the authorization request with forceShowDialog set to true. This bypasses cached login state and forces Spotify to show the login screen. Not as clean as the old signOut method, but users get the same experience. Just make sure you completely wipe all stored auth artifacts before triggering the new flow.
Totally get u! I faced this issue too. I just cleared shared prefs and called AuthorizationClient.clearCookies() - did the trick for me. It’s frustrating that spotify removed that method without any good alternative.
This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.