How to log a user out of Spotify after logging in and calling the web API

Im using the Spotify Web API to get a list of playlists and track the user. Authorization is working fine. I also get track details. But after that I want to remove the user from the list and allow a new login. There is a session time until the user automatically logs out of the spotify account. But the user may not have the patience to wait so long and try using another spotify account.

Is there any API to exit the user name.

What can be done. Please, help.

+6
source share
2 answers

While an application using the Spotify Web API cannot log off a user, it can force a permission dialog to be displayed during the login process. To do this, use the show_dialog request show_dialog and set it to true when the endpoint is called https://accounts.spotify.com/authorize .

If the user is already logged in, there will be a link to change the user (Not you?) .

This applies to the Authorization Code and Implicit Grant streams. You can read the documentation for the show_dialog parameter in the Spotify Web API Authorization Guide .

+5
source

You want to simply exit the "spotify web api" , then you must end the spotify session through a clear authentication token , eg:

 AuthenticationClient.clearCookies(getApplication()); 
+1
source

Source: https://habr.com/ru/post/971338/


All Articles