Fix token issue with Peertube
This commit is contained in:
parent
5fa0cbe878
commit
e52a37c5b7
|
@ -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,12 +761,11 @@ 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"));
|
||||||
new AccountDAO(context, db).updateAccount(targetedAccount);
|
new AccountDAO(context, db).updateAccount(targetedAccount);
|
||||||
|
|
Loading…
Reference in New Issue