[英]Spotify logout on android
我有這個代碼登錄以在我的應用程序中spotify。 我使用官方的spotify lib。
public void spotifyLoginBtnClicked(View v){
//start the authentication for spotify
AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(clientID, AuthenticationResponse.Type.TOKEN, redirectURI);
builder.setScopes(new String[]{"user-read-private", "streaming"});
AuthenticationRequest request = builder.build();
// open LoginActivity
AuthenticationClient.openLoginActivity(this, activityIdentification, request);
}
我現在想知道如何創建一個注銷按鈕。 因為一旦登錄,如果我再次按下登錄按鈕,它就會返回。 所以我無法改變用戶。 我在java doc中找不到任何東西。
我剛剛發現這個文檔看起來類似於您登錄時粘貼的代碼。
在那里它提到了一些記錄用戶的方法,但我認為你需要的主要代碼塊是:
To log out and clear all stored tokens, use the AuthenticationClient#clearCookies method. Both Spotify and Facebook tokens will be removed.
我會去檢查上面鏈接的那篇文章,因為有可能對你的項目很重要的邊緣情況。
快樂的編碼!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.