mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-01-31 13:07:32 +01:00
Auth: Do not try to get token for non-existing accounts
This commit is contained in:
parent
5e39818a20
commit
eaef4bc151
@ -124,6 +124,13 @@ public class AuthManager {
|
|||||||
getAccountManager().setUserData(getAccount(), key, value);
|
getAccountManager().setUserData(getAccount(), key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accountExists() {
|
||||||
|
for (Account refAccount : getAccountManager().getAccountsByType(accountType)) {
|
||||||
|
if (refAccount.name.equalsIgnoreCase(accountName)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public String peekAuthToken() {
|
public String peekAuthToken() {
|
||||||
Log.d(TAG, "peekAuthToken: " + buildTokenKey());
|
Log.d(TAG, "peekAuthToken: " + buildTokenKey());
|
||||||
return getAccountManager().peekAuthToken(getAccount(), buildTokenKey());
|
return getAccountManager().peekAuthToken(getAccount(), buildTokenKey());
|
||||||
|
@ -93,6 +93,10 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
|
|||||||
Bundle result = new Bundle();
|
Bundle result = new Bundle();
|
||||||
result.putString(KEY_ACCOUNT_NAME, accountName);
|
result.putString(KEY_ACCOUNT_NAME, accountName);
|
||||||
result.putString(KEY_ACCOUNT_TYPE, authManager.getAccountType());
|
result.putString(KEY_ACCOUNT_TYPE, authManager.getAccountType());
|
||||||
|
if (!authManager.accountExists()) {
|
||||||
|
result.putString(KEY_ERROR, "NetworkError");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
AuthResponse res = authManager.requestAuth(false);
|
AuthResponse res = authManager.requestAuth(false);
|
||||||
if (res.auth != null) {
|
if (res.auth != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user