AndlyticsProject / andlytics

Google Play - Android Market statistics app
Other
535 stars 181 forks source link

Failing again, I think maybe the console changed? #747

Closed casolorz closed 7 years ago

casolorz commented 7 years ago

I went ahead and submitted the error report. If you need logs I'll be able to get them in a few hours. Thanks,

dieterthiess commented 7 years ago

It seems google removed the versionName in the JSON, so this is going to fail.

        app.setVersionName(jsonAppDetails.getString("4"));

Will check & confirm this later.

casolorz commented 7 years ago

Since I can't get this to run on my machine and I have to depend on you guys to fix it, do you have a donation account somewhere?

dieterthiess commented 7 years ago

I also tried to check if the versionName is the only change, but if i try to run, i get the E/OauthAccountManagerAuthenticator: Unrecoverable authentication exception: UNREGISTERED_ON_API_CONSOLE error. This was mentioned here before, but i do not have a solution at the moment.

nelenkov commented 7 years ago

Pushed an update that fixes this error and sets active installs.

casolorz commented 7 years ago

Thank you, I really appreciate it.

nelenkov commented 7 years ago

As for building the app, maybe Google is limiting the number of people who can register the same package? Paste the SHA1 hash of your debug certificate and I'll register it it my account, maybe that will make a difference.

casolorz commented 7 years ago

I did try a different package but yeah we can try that. I'll put it here early next week. Thanks.

magnusgronbek commented 7 years ago

HI nelenkov, Can you try to register my SHA1 hash of my debug certificate as well? Can I email you my cert?

nelenkov commented 7 years ago

Just put the hash here, if it ends up working, I'll add a debug key/cert to the repo.

magnusgronbek commented 7 years ago

Here is my sha1 hash:

xxx

nelenkov commented 7 years ago

API console gives me a 'keystore already registered' error.

Try using the keystore in the dev branch, password is the name of this repo:

https://github.com/AndlyticsProject/andlytics/tree/dev/keystore

(this is NOT the app release keystore)

magnusgronbek commented 7 years ago

Used keystore from dev branch and following configuration in build.gradle:

signingConfigs { debug { storeFile file("keystore/andlytics.jks") storePassword 'xxxx' keyAlias 'xxxx' keyPassword 'xxxx' } }

But I am still getting INVALID_SCOPE:

06-19 21:37:15.747 7084-7151/com.github.andlyticsproject E/OauthAccountManagerAuthenticator: Unrecoverable authentication exception: INVALID_SCOPE com.google.android.gms.auth.GoogleAuthException: INVALID_SCOPE at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticateInternal(OauthAccountManagerAuthenticator.java:123) at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticate(OauthAccountManagerAuthenticator.java:71) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticate(DevConsoleV2.java:349) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticateWithCachedCredentialas(DevConsoleV2.java:324) at com.github.andlyticsproject.console.v2.DevConsoleV2.getAppInfo(DevConsoleV2.java:97) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:558) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:525) at android.os.AsyncTask$2.call(AsyncTask.java:287) at java.util.concurrent.FutureTask.run(FutureTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:841) 06-19 21:37:16.077 7084-7151/com.github.andlyticsproject E/OauthAccountManagerAuthenticator: Unrecoverable authentication exception: INVALID_SCOPE com.google.android.gms.auth.GoogleAuthException: INVALID_SCOPE at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticateInternal(OauthAccountManagerAuthenticator.java:123) at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticate(OauthAccountManagerAuthenticator.java:71) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticate(DevConsoleV2.java:349) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticateFromScratch(DevConsoleV2.java:328) at com.github.andlyticsproject.console.v2.DevConsoleV2.getAppInfo(DevConsoleV2.java:103) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:558) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:525) at android.os.AsyncTask$2.call(AsyncTask.java:287) at java.util.concurrent.FutureTask.run(FutureTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:841) 06-19 21:37:16.102 7084-7151/com.github.andlyticsproject E/Main: Error while requesting developer console : com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticateInternal(OauthAccountManagerAuthenticator.java:139) com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticate(OauthAccountManagerAuthenticator.java:71) com.github.andlyticsproject.console.v2.DevConsoleV2.authenticate(DevConsoleV2.java:349) com.github.andlyticsproject.console.v2.DevConsoleV2.authenticateFromScratch(DevConsoleV2.java:328) com.github.andlyticsproject.console.v2.DevConsoleV2.getAppInfo(DevConsoleV2.java:103) com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:558) com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:525) android.os.AsyncTask$2.call(AsyncTask.java:287) java.util.concurrent.FutureTask.run(FutureTask.java:234) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) java.lang.Thread.run(Thread.java:841) 06-19 21:37:16.112 7084-7151/com.github.andlyticsproject E/Main: Error while requesting developer console : Authentication error: INVALID_SCOPE com.github.andlyticsproject.console.AuthenticationException: Authentication error: INVALID_SCOPE at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticateInternal(OauthAccountManagerAuthenticator.java:139) at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticate(OauthAccountManagerAuthenticator.java:71) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticate(DevConsoleV2.java:349) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticateFromScratch(DevConsoleV2.java:328) at com.github.andlyticsproject.console.v2.DevConsoleV2.getAppInfo(DevConsoleV2.java:103) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:558) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:525) at android.os.AsyncTask$2.call(AsyncTask.java:287) at java.util.concurrent.FutureTask.run(FutureTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:841) 0

casolorz commented 7 years ago

Yeah same here.

casolorz commented 7 years ago

Just to make sure I got the SHA 1 from the keystore and from the apk and they are the same, so that's not the issue.

nelenkov commented 7 years ago

Ok, I think I've figured it out.

It tries to get both an OAuth token and a Google Drive token (for app data backup), and that's why it fails.

If you remove the backup API key from AndroidManifest.xml, it should work. Like so:

+<!--
         <meta-data
             android:name="com.google.android.backup.api_key"
             android:value="@string/backup_api_key" />
+        -->

Please give it a try.

There doesn't seem to be a way to specify the signing certificate when getting a backup key, only the package. So we have to either remove it, or create a new configuration/flavor without the backup feature.

nelenkov commented 7 years ago

Hm, looks like it was just using a cached token...

casolorz commented 7 years ago

I removed the meta-data and still got the error. Anything else I should try?

06-20 08:53:47.415 27328-27471/com.github.andlyticsproject E/OauthAccountManagerAuthenticator: Unrecoverable authentication exception: INVALID_SCOPE com.google.android.gms.auth.GoogleAuthException: INVALID_SCOPE at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticateInternal(OauthAccountManagerAuthenticator.java:123) at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticate(OauthAccountManagerAuthenticator.java:71) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticate(DevConsoleV2.java:349) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticateWithCachedCredentialas(DevConsoleV2.java:324) at com.github.andlyticsproject.console.v2.DevConsoleV2.getAppInfo(DevConsoleV2.java:97) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:558) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:525) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) 06-20 08:53:47.622 27328-27471/com.github.andlyticsproject E/OauthAccountManagerAuthenticator: Unrecoverable authentication exception: INVALID_SCOPE com.google.android.gms.auth.GoogleAuthException: INVALID_SCOPE at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticateInternal(OauthAccountManagerAuthenticator.java:123) at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticate(OauthAccountManagerAuthenticator.java:71) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticate(DevConsoleV2.java:349) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticateFromScratch(DevConsoleV2.java:328) at com.github.andlyticsproject.console.v2.DevConsoleV2.getAppInfo(DevConsoleV2.java:103) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:558) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:525) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) 06-20 08:53:47.623 27328-27471/com.github.andlyticsproject E/Main: Error while requesting developer console : com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticateInternal(OauthAccountManagerAuthenticator.java:139) com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticate(OauthAccountManagerAuthenticator.java:71) com.github.andlyticsproject.console.v2.DevConsoleV2.authenticate(DevConsoleV2.java:349) com.github.andlyticsproject.console.v2.DevConsoleV2.authenticateFromScratch(DevConsoleV2.java:328) com.github.andlyticsproject.console.v2.DevConsoleV2.getAppInfo(DevConsoleV2.java:103) com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:558) com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:525) android.os.AsyncTask$2.call(AsyncTask.java:295) java.util.concurrent.FutureTask.run(FutureTask.java:237) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) java.lang.Thread.run(Thread.java:818) 06-20 08:53:47.624 27328-27471/com.github.andlyticsproject E/Main: Error while requesting developer console : Authentication error: INVALID_SCOPE com.github.andlyticsproject.console.AuthenticationException: Authentication error: INVALID_SCOPE at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticateInternal(OauthAccountManagerAuthenticator.java:139) at com.github.andlyticsproject.console.v2.OauthAccountManagerAuthenticator.authenticate(OauthAccountManagerAuthenticator.java:71) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticate(DevConsoleV2.java:349) at com.github.andlyticsproject.console.v2.DevConsoleV2.authenticateFromScratch(DevConsoleV2.java:328) at com.github.andlyticsproject.console.v2.DevConsoleV2.getAppInfo(DevConsoleV2.java:103) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:558) at com.github.andlyticsproject.Main$LoadRemoteEntries.doInBackground(Main.java:525) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

nelenkov commented 7 years ago

I was mistaken, see my comment above.

I compared the raw HTTP requests, the only difference is the package signature.

I've removed my debug certificate to see if there is a limit to the number of certificates that can be registered for one package, but it doesn't seem to make a difference.

magnusgronbek commented 7 years ago

Still getting same error, INVALID_SCOPE

hasanjamshaid commented 7 years ago

I used this code a few months before and it was working properly. I think google is improving their authentication system as this method of authorization was used by Pokemon Go IOS app and it created lot of trouble for them. As why Pokemon Go require google 'full access' permission from users.

nelenkov commented 7 years ago

This method is also used for Chrome login on Android. It does appear that you cannot register new applications/certificates though. The original signing certificate (registered in 2013) works, but any new ones I add don't. As I said, the only difference in the token request is the package signature (SHA-1 hash of the signing certificate).

If you want to test the application you could try using the username/password authentication mechanism.

Another idea would be to reverse engineer the official developer console application. But then you can just use that...

nelenkov commented 7 years ago

I any case, the original issue has been fixed and released, so closing this.