Fix token issue with Peertube

This commit is contained in:
tom79 2019-06-06 16:03:45 +02:00
parent 5fa0cbe878
commit e52a37c5b7
1 changed files with 4 additions and 8 deletions

View File

@ -17,12 +17,9 @@ package app.fedilab.android.client;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -764,11 +761,10 @@ public class PeertubeAPI {
targetedAccount.setToken(values.get("access_token")); targetedAccount.setToken(values.get("access_token"));
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null); String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
//This account is currently logged in, the token is updated //This account is currently logged in, the token is updated
if (prefKeyOauthTokenT.equals(token)) { SharedPreferences.Editor editor = sharedpreferences.edit();
SharedPreferences.Editor editor = sharedpreferences.edit(); prefKeyOauthTokenT = targetedAccount.getToken();
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, targetedAccount.getToken()); editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, targetedAccount.getToken());
editor.apply(); editor.apply();
}
} }
if (values.containsKey("refresh_token") && values.get("refresh_token") != null) if (values.containsKey("refresh_token") && values.get("refresh_token") != null)
targetedAccount.setRefresh_token(values.get("refresh_token")); targetedAccount.setRefresh_token(values.get("refresh_token"));