question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting Google API Exception: 10

See original GitHub issue

Followed the instructions, but am getting this error on calling Plugins.GoogleAuth.signIn():

V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 39112375, pluginId: GoogleAuth, methodName: signIn
V/Capacitor: callback: 39112375, pluginId: GoogleAuth, methodName: signIn, methodData: {}
D/Capacitor: Starting activity for result
I/Timeline: Timeline: Activity_launch_request time:4659556 intent:Intent { act=com.google.android.gms.auth.GOOGLE_SIGN_IN pkg=v.lucidfrontier cmp=v.lucidfrontier/com.google.android.gms.auth.api.signin.internal.SignInHubActivity (has extras) }
D/Capacitor: App paused
W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@2c88202
I/Timeline: Timeline: Activity_launch_request time:4659584 intent:Intent { act=com.google.android.gms.auth.GOOGLE_SIGN_IN pkg=com.google.android.gms (has extras) }
E/Capacitor/Plugin: Something went wrong
    com.google.android.gms.common.api.ApiException: 10: 
        at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source:4)
        at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source:8)
        at com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.handleOnActivityResult(GoogleAuth.java:62)
        at com.getcapacitor.Bridge.onActivityResult(Bridge.java:729)
        at com.getcapacitor.BridgeActivity.onActivityResult(BridgeActivity.java:209)
        at android.app.Activity.dispatchActivityResult(Activity.java:7590)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4412)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4461)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:201)
        at android.app.ActivityThread.main(ActivityThread.java:6806)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
D/Capacitor: Sending plugin error: {"save":false,"callbackId":"39112375","pluginId":"GoogleAuth","methodName":"signIn","success":false,"error":{"message":"Something went wrong"}}
D/Capacitor/Plugin/App: Firing change: true
V/Capacitor/Plugin/App: Notifying listeners for event appStateChange
D/Capacitor/Plugin/App: No listeners found for event appStateChange
D/Capacitor: App resumed
V/Capacitor/Plugin/Network: Notifying listeners for event networkStatusChange
D/Capacitor/Plugin/Network: No listeners found for event networkStatusChange
V/Capacitor: callback: -1, pluginId: Console, methodName: log, methodData: {"level":"error","message":"LogError) An error has occurred: Something went wrong\n"}
E/Capacitor/Plugin/Console: LogError) An error has occurred: Something went wrong

Am investigating more, and will update this issue if I find the solution.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
Venryxcommented, Jul 29, 2019

It does appear to be the same issue hit by #10. Your instructions also appear to be correct, as I can now use the sign-in panel and focus returns to my app without errors.

To help others, I thought I’d lay out all the steps: (this is assuming you’ve already completed the steps relating to “client id” from the plugin’s readme – to clarify, you should use the web client id for those instructions, not the android client id you’ll be creating in step 1 below)

  1. Follow steps 1 and 2 from this SO answer (I only partially completed step 3 – it doesn’t seem to be necessary for my case): https://stackoverflow.com/a/49800546/2441655
  2. Go to: https://console.cloud.google.com/apis/credentials
  3. Click on the “Web client (auto created by Google Service)” item in the “OAuth 2.0 client IDs” list.
  4. Add your in-web-view domain to the “Authorized JavaScript origins” list.
  5. Add your in-web-view domain to the “Authorized redirect URIs” list.

I’m not very confident I know what I’m doing with all these configurations, but at least the sign-in panel seems to be succeeding/not-erroring.

However, the plugin doesn’t seem to be “magically” transferring the sign-in data to my webapp the way I expected it to. In other words, I expected it to cause the website to act as if the in-regular-browser sign in process had occurred, but instead it still says “sign in” in my website’s regular sign-in panel.

Something to note: My Capacitor webview is not set to load the site contents from the folder packaged with the app. That “site contents” is just a js file that executes window.location.href = "myapp.com";

Is this plugin not compatible with webviews that redirect and just display the regular website contents? (ie. does it require that the webview be serving up the local site contents packaged with the app?)

If it is compatible with “online” webviews, how do I get the plugin to transfer the android-app sign-in data to the regular myapp.com javascript code/context?

1reaction
Venryxcommented, Jul 29, 2019

Oops, you beat me by 13 seconds!

Thanks for the url config tip, though – I’ll use that from now on. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google SignIn Fails with code 10 (on Android) #360 - GitHub
This error might happen if you are not using same project at console.developers.google and console.firebase.google.com. If project is same at ...
Read more >
ApiException | Google Play services
Exception to be returned by a Task when a call to Google Play services has failed.
Read more >
Google Sign-In: API Exception 10 : r/flutterhelp - Reddit
I am encountering this error: PlatformException (PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: ...
Read more >
PlatformException(sign_in_failed, com.google.android.gms ...
[SOLVED] Flutter : PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null) · ERROR · SOLUTION.
Read more >
Authenticate with Google on Android - Firebase
You can let your users authenticate with Firebase using their Google Accounts. Before you begin ... catch (ApiException e) { // ... }...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found