New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Google API Exception: 10 #15
Comments
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)
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 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 |
@Venryx It does return the data to your web app regardless of it being online or local. However, what happens next is for your web app to decide and handle. Also, instead of redirecting via a packaged js file you can just configure
|
Nevermind, I figured it out. I use a library that integrates firebase into redux, and it also "wraps" the firebase authentication process: https://github.com/prescottprue/react-redux-firebase So what I had to do is retrieve the sign-in data from android, and pass it to that library:
(The comment regarding "the sign-in data gets cleared otherwise" I think is just because I'm using an older version of the library which doesn't support the "signInAndRetrieveDataWithCredential" Firebase function -- plan to update soon.) An alternative to the approach above, I believe, is to just copy the auth-data directly into redux -- but the approach above seems to work fine so I'll stick with it for now. Anyway, I'm really new to Capacitor (and Firebase on Android in general) -- just started a few hours ago, so I think I'll leave good enough alone and work on higher-level stuff until I'm getting ready for release of the app. Then I'll do my homework and find out how to make the authentication system a bit more robust. :) Thanks for your pointers. |
Oops, you beat me by 13 seconds! Thanks for the |
@saravanababu1694 Try following my instructions here: #15 (comment) Direct answer of which type of OAuth Client ID to create? Well, it's been a while, but re-reading my instructions apparently you're supposed to use your project's auto-created web client ID (for the plugin readme, prerequisite step) and create an Android app ID (for step 2 of the StackOverflow answer I linked to). Not sure if both are necessary, but those are the steps I took to get it working. (again, check my instructions in my linked comment above) |
Hi @Venryx thanks for your instructions! I have it working for Web, but can't get it working in Android I have created web client id and the android app id as well (but just using the web client id), but I'm still getting the exception 10. I'm using just capacitor (not ionic), and running it from Android Studio (after running I guess the problem is in the console's configuration. What do you mean by "in-web-view domain" in points 4 and 5? I have this, for now to test, but none works (in production I just will setup my own domain): As you can see, I have tried with different IPs (192.168.1.4 is my laptop and 192.168.1.3 is my tablet)... how should it be? Thanks in advance! |
Sorry, I was using a wrong SHA1... Thanks! |
Can someone make this clear please? Do I have to use the android client id or not? In demos there are different ID's as described in this ticket #35 I have created the Android client id, added SHA1, added it to the firebase, updated google-services.json, used web client id as described in capacitor.json, strings.xml and index.html. Despite that I can't still make it work on android |
ok figure it out, you have to also setup OAuth consent screen as external with support address https://stackoverflow.com/questions/56196172/error-403-restricted-client-with-google-signin-in-flutter |
In my case I solved the problem on capacitor 4 using the type 3 SHA-1 (oauth default web client) and string config server_client_id. |
Followed the instructions, but am getting this error on calling
Plugins.GoogleAuth.signIn()
:Am investigating more, and will update this issue if I find the solution.
The text was updated successfully, but these errors were encountered: