Loading app/src/main/java/foundation/e/accountmanager/syncadapter/GoogleAccountAuthenticatorService.kt +4 −4 Original line number Diff line number Diff line Loading @@ -119,12 +119,12 @@ class GoogleAccountAuthenticatorService : Service(), OnAccountsUpdateListener { override fun getAuthTokenLabel(p0: String?) = null override fun confirmCredentials(p0: AccountAuthenticatorResponse?, p1: Account?, p2: Bundle?) = null override fun updateCredentials(p0: AccountAuthenticatorResponse?, p1: Account?, p2: String?, p3: Bundle?) = null override fun getAuthToken(response: AccountAuthenticatorResponse?, account: Account?, authTokenType: String?, options: Bundle?): Bundle? { override fun getAuthToken(response: AccountAuthenticatorResponse?, account: Account?, authTokenType: String?, options: Bundle?): Bundle { val accountManager = AccountManager.get(context) val authState = AuthState.jsonDeserialize(accountManager.getUserData(account, AccountSettings.KEY_AUTH_STATE)) if (authState != null) { if (authState.needsTokenRefresh || true) { //keep true for now since it is refreshed only when invalidated, so when having an issue if (authState.needsTokenRefresh) { val tokenRequest = authState.createTokenRefreshRequest() AuthorizationService(context).performTokenRequest(tokenRequest) { tokenResponse, ex -> Loading @@ -136,7 +136,6 @@ class GoogleAccountAuthenticatorService : Service(), OnAccountsUpdateListener { result.putString(AccountManager.KEY_AUTHTOKEN, authState.accessToken) response?.onResult(result) } return null; //should return null when returned via an async response } else { val result = Bundle() Loading @@ -155,3 +154,4 @@ class GoogleAccountAuthenticatorService : Service(), OnAccountsUpdateListener { } } Loading
app/src/main/java/foundation/e/accountmanager/syncadapter/GoogleAccountAuthenticatorService.kt +4 −4 Original line number Diff line number Diff line Loading @@ -119,12 +119,12 @@ class GoogleAccountAuthenticatorService : Service(), OnAccountsUpdateListener { override fun getAuthTokenLabel(p0: String?) = null override fun confirmCredentials(p0: AccountAuthenticatorResponse?, p1: Account?, p2: Bundle?) = null override fun updateCredentials(p0: AccountAuthenticatorResponse?, p1: Account?, p2: String?, p3: Bundle?) = null override fun getAuthToken(response: AccountAuthenticatorResponse?, account: Account?, authTokenType: String?, options: Bundle?): Bundle? { override fun getAuthToken(response: AccountAuthenticatorResponse?, account: Account?, authTokenType: String?, options: Bundle?): Bundle { val accountManager = AccountManager.get(context) val authState = AuthState.jsonDeserialize(accountManager.getUserData(account, AccountSettings.KEY_AUTH_STATE)) if (authState != null) { if (authState.needsTokenRefresh || true) { //keep true for now since it is refreshed only when invalidated, so when having an issue if (authState.needsTokenRefresh) { val tokenRequest = authState.createTokenRefreshRequest() AuthorizationService(context).performTokenRequest(tokenRequest) { tokenResponse, ex -> Loading @@ -136,7 +136,6 @@ class GoogleAccountAuthenticatorService : Service(), OnAccountsUpdateListener { result.putString(AccountManager.KEY_AUTHTOKEN, authState.accessToken) response?.onResult(result) } return null; //should return null when returned via an async response } else { val result = Bundle() Loading @@ -155,3 +154,4 @@ class GoogleAccountAuthenticatorService : Service(), OnAccountsUpdateListener { } }