mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-11-14 15:05:06 +00:00
Auth: Do not try to get token for non-existing accounts
This commit is contained in:
parent
5e39818a20
commit
eaef4bc151
2 changed files with 11 additions and 0 deletions
|
@ -124,6 +124,13 @@ public class AuthManager {
|
|||
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() {
|
||||
Log.d(TAG, "peekAuthToken: " + buildTokenKey());
|
||||
return getAccountManager().peekAuthToken(getAccount(), buildTokenKey());
|
||||
|
|
|
@ -93,6 +93,10 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
|
|||
Bundle result = new Bundle();
|
||||
result.putString(KEY_ACCOUNT_NAME, accountName);
|
||||
result.putString(KEY_ACCOUNT_TYPE, authManager.getAccountType());
|
||||
if (!authManager.accountExists()) {
|
||||
result.putString(KEY_ERROR, "NetworkError");
|
||||
return result;
|
||||
}
|
||||
try {
|
||||
AuthResponse res = authManager.requestAuth(false);
|
||||
if (res.auth != null) {
|
||||
|
|
Loading…
Reference in a new issue