CapacitorGoogleAuth
CapacitorGoogleAuth copied to clipboard
Problem with new MainActivity.java file.
Hello. I updated to android studio 4.2.1 and Capacitor 3 plugins. This new updates give an empty MainActivity.java file with only this lines:
package com.aplicationname.app;
import com.getcapacitor.BridgeActivity;
public class MainActivity extends BridgeActivity {
}
then I have to change to:
package com.aplicationname.app;
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth;
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerPlugin(GoogleAuth.class);
}
}
Hi @juanmafont I also upgraded by application from capacitor 2 to capacitor 3. Now, I am facing issue with google login.
I am using @codetrix-studio/capacitor-google-auth": "3.0.1" plugin for this. And I am getting the following issue in android, for web its working fine.
Hi @juanmafont I also upgraded by application from capacitor 2 to capacitor 3. Now, I am facing issue with google login.
I am using @codetrix-studio/capacitor-google-auth": "3.0.1" plugin for this. And I am getting the following issue in android, for web its working fine.
Check this list:
- At index.html you added your web key:
<meta name="google-signin-client_id" content="653953...82hpe.apps.googleusercontent.com">
- Into file strings.xml you are using WEB KEY (not android key) :
<string name="server_client_id">653953....82hpe.apps.googleusercontent.com</string>
- Into capacitor.config.json you are usin again WEB KEY (not android key):
"plugins": { "GoogleAuth": { "scopes": [ "profile", "email" ], "serverClientId": "653953.....82hpe.apps.googleusercontent.com", "forceCodeForRefreshToken": true } },
- Obviously, check MainActivity.java has this lines:
import com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth; registerPlugin(GoogleAuth.class);
- you has a file google-services.json at -> yourapp/android/app with good keys and hash sha1 code.
- You signed your apk with good sha1 code (same into file google-services.json and same at https://console.firebase.google.com/)
- At you ionic/angular app your code when initialized authentication is similar to:
constructor() { // Only web if (Capacitor.isNativePlatform() === false) { GoogleAuth.init(); }
.... so be sure only GoogleAuth.init() launched when web (browser), not android or ios.
Hi @juanmafont I also upgraded by application from capacitor 2 to capacitor 3. Now, I am facing issue with google login. I am using @codetrix-studio/capacitor-google-auth": "3.0.1" plugin for this. And I am getting the following issue in android, for web its working fine.
Check this list:
- At index.html you added your web key:
<meta name="google-signin-client_id" content="653953...82hpe.apps.googleusercontent.com">
- Into file strings.xml you are using WEB KEY (not android key) :
<string name="server_client_id">653953....82hpe.apps.googleusercontent.com</string>
- Into capacitor.config.json you are usin again WEB KEY (not android key):
"plugins": { "GoogleAuth": { "scopes": [ "profile", "email" ], "serverClientId": "653953.....82hpe.apps.googleusercontent.com", "forceCodeForRefreshToken": true } },
- Obviously, check MainActivity.java has this lines:
import com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth; registerPlugin(GoogleAuth.class);
- you has a file google-services.json at -> yourapp/android/app with good keys and hash sha1 code.
- You signed your apk with good sha1 code (same into file google-services.json and same at https://console.firebase.google.com/)
- At you ionic/angular app your code when initialized authentication is similar to:
constructor() { // Only web if (Capacitor.isNativePlatform() === false) { GoogleAuth.init(); }
.... so be sure only GoogleAuth.init() launched when web (browser), not android or ios.
Hi @juanmafont I used the android keys as you mentioned. Now I am getting the following error.
It's stuck here...
Checkout my solution here: https://github.com/CodetrixStudio/CapacitorGoogleAuth/issues/110#issuecomment-864494481
After I pick up the Google account
And then it´s always loading ...
@FabioGoncalves Can you please share steps and code snippets on how you achieved that. I have spent the past 4-5 days looking for a solution to get it done
Hi @codemickey78 , I just have this
,
but before you have to settle some requirements, you can find them here:
https://github.com/CodetrixStudio/CapacitorGoogleAuth
https://devdactic.com/capacitor-google-sign-in/
https://www.youtube.com/watch?v=Rs1imvTbeN0
I tryed today, and it's working so you can do it :)
Hi @codemickey78 , I just have this
,
but before you have to settle some requirements, you can find them here: https://github.com/CodetrixStudio/CapacitorGoogleAuth https://devdactic.com/capacitor-google-sign-in/ https://www.youtube.com/watch?v=Rs1imvTbeN0
I tryed today, and it's working so you can do it :)
Hello @FabioGoncalves,
Can you please explain me that how you resolve the white screen loading issue? Here i got same issue. Still Struck on Android. But web is working. I need to resolve this in android.
Thanks.
Hi @FabioGoncalves and @iamkbkarthikeyan
Did you find a solution ? I have the same issue. It worked on the web but not in Android (emulator Pixel 3 API 30 with Webview Chrome 92). In Android, it stays in the loading state after I picked a Google Account. My env : Ionic CLI 6.17.0 Capacitor 3.1.2 Node 14.17.0 Android Studio Artic Fox 2020.3.1
Hi @codemickey78 , I just have this
,
but before you have to settle some requirements, you can find them here: https://github.com/CodetrixStudio/CapacitorGoogleAuth https://devdactic.com/capacitor-google-sign-in/ https://www.youtube.com/watch?v=Rs1imvTbeN0 I tryed today, and it's working so you can do it :)
Hello @FabioGoncalves,
Can you please explain me that how you resolve the white screen loading issue? Here i got same issue. Still Struck on Android. But web is working. I need to resolve this in android.
Thanks.
Did you resolve it?
Hi @FabioGoncalves and @iamkbkarthikeyan
Did you find a solution? I have the same issue. It worked on the web but not in Android (emulator Pixel 3 API 30 with Webview Chrome 92). In Android, it stays in the loading state after I picked a Google Account. My env : Ionic CLI 6.17.0 Capacitor 3.1.2 Node 14.17.0 Android Studio Artic Fox 2020.3.1
I had the same issue, did you configure all the specs? If so, I just needed to wait, in the next day, I tried again and it worked, maybe some configs that google needed to do? Don't know :D
https://github.com/CodetrixStudio/CapacitorGoogleAuth/issues/116#issuecomment-900725993
Maybe this issue can help :)
I had tried all of the above steps, and it was still getting stuck with a loading screen, after having selected an emailId. Then, I went to the OAuth Consent screen, and added my emailId to the list of Tester emails. and it worked.
Thanks for all the help.
Hi @FabioGoncalves and @iamkbkarthikeyan
Did you find a solution ? I have the same issue. It worked on the web but not in Android (emulator Pixel 3 API 30 with Webview Chrome 92). In Android, it stays in the loading state after I picked a Google Account. My env : Ionic CLI 6.17.0 Capacitor 3.1.2 Node 14.17.0 Android Studio Artic Fox 2020.3.1
Hello, @titib, How are you? This is Bai Feng. I implemented Google Auth in ionic/capacitor3/React. but Google Login not working in the web browser. https://prnt.sc/1wq8wfp https://prnt.sc/1wqey75 this is the screenshots I faced.
could you help me?
FabioGoncalves great ! :)