microg / microg/GmsCore

`AuthManagerServiceImpl.getTokenWithAccount` missing package overriding feature

Open
#3,278 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
14.6k
Forks
3.2k
Avg merge
12d 11h
Merged PRs (30d)
4

Description

So I was looking into implementing the user flavour for YouTube by patching the app. However I came across:

```
02-14 23:17:33.723 32358 32550 W GmsAuthManagerSvc: java.io.IOException: org.microg.gms.common.NotOkayException: Error=UNREGISTERED_ON_API_CONSOLE
02-14 23:17:33.723 32358 32550 W GmsAuthManagerSvc: LoggableAuthErrorMessage=This android application is not registered to use OAuth2.0, please confirm the package name and SHA-1 certificate fingerprint match what you registered in Google Developer Console. See https://developer.android.com/google/auth/http-auth.html#Register for more information. Common fixes include checking that the app is signed with the registered key, and that applicationId and applicationIdSuffix are set to appropriate values in Android Studio.
02-14 23:17:33.723 32358 32550 W GmsAuthManagerSvc: at org.microg.gms.auth.AuthManager.requestAuthWithBackgroundResolution(AuthManager.java:277)
02-14 23:17:33.723 32358 32550 W GmsAuthManagerSvc: at org.microg.gms.auth.AuthManagerServiceImpl.getTokenWithAccount(AuthManagerServiceImpl.java:148)
02-14 23:17:33.723 32358 32550 W GmsAuthManagerSvc: at com.google.android.auth.IAuthManagerService$Stub.onTransact(IAuthManagerService.java:135)
02-14 23:17:33.723 32358 32550 W GmsAuthManagerSvc: at org.microg.gms.auth.AuthManagerServiceImpl.onTransact(AuthManagerServiceImpl.java:275)
02-14 23:17:33.723 32358 32550 W GmsAuthManagerSvc: at android.os.Binder.execTransactInternal(Binder.java:1473)
02-14 23:17:33.723 32358 32550 W GmsAuthManagerSvc: at android.os.Binder.execTransact(Binder.java:1418)
02-14 23:17:33.723 32358 32550 W GmsAuthManagerSvc: Caused by: org.microg.gms.common.NotOkayException: Error=UNREGISTERED_ON_API_CONSOLE
```

Despite implementing package overriding for MicroG GmsCore. I traced it back to `AuthManagerServiceImpl.getTokenWithAccount`. It looks like AuthManager is instantiated with the original package name:

Image

while this logic from `getAuthToken` is missing:

Image

I am not entirely sure whats going on but this is my best bet so far. Is this intentional?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in AuthManagerServiceImpl.java at getTokenWithAccount and compare how getAuthToken handles package overriding before AuthManager is instantiated. Trace the package name passed into the authentication flow and verify that the overriding behavior used by MicroG GmsCore is also applied here. Reproduce the OAuth error if possible and confirm that the request no longer uses the original package name.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.