Ionic Cordova Google Login

Hello,

I’m creating an app with Google authentication and using the https://www.npmjs.com/package/@capacitor-firebase/authentication.
For the web, it’s working fine. But when I tried to run the same login in the Android app, the default browser was opened and after login, the redirect for the app did not occur. After the successful login the browser redirects to the https://localhost/{route}.

I created the Android app on Firebase account, set sha1 (and signed the app), set the steps inside here https://github.com/capawesome-team/capacitor-firebase/blob/0abbb8d74afc52789cab38b6de3f9436dad9d1ae/docs/firebase-setup.md#android and here https://github.com/capawesome-team/capacitor-firebase/blob/0abbb8d74afc52789cab38b6de3f9436dad9d1ae/packages/authentication/docs/setup-google.md

But the correct redirect not working.

Anyone have any idea why its not working? Any help is welcome.

Thank you for your time and help.

This is not enough information to help you. Something is wrong with your configuration. Feel free to have a look at our official demo app. You might also find this Android setup guide from Ionstarter helpful.

@robingenz Thank you for your fast reply.

I tried the official demo app, but when I run the npx ionic cap run android and choose the emulator, I catch two errors:

1: Task failed with an exception.
[capacitor]         -----------
[capacitor]         * Where:
[capacitor]         Build file '/capacitor-firebase-authentication-demo/android/app/build.gradle' line: 5
[capacitor]         
[capacitor]         * What went wrong:
[capacitor]         A problem occurred evaluating project ':app'.
[capacitor]         > /capacitor-firebase-authentication-demo/android/keystore.properties (File or directory nonexistent)

and

2: Task failed with an exception.
[capacitor]         -----------
[capacitor]         * What went wrong:
[capacitor]         A problem occurred configuring project ':app'.
[capacitor]         > compileSdkVersion is not specified. Please add it to build.gradle

Can you help me solve these problems? I think if I solve these problems and make it work I can replicate it to my own app.

Thank for your help and time!

@Hills90210 Thank for your help…

I’m not specialist on mobile development, sorry. I will add more information about the root question.

Could you help me to solve this problem?

There is no need to be a mobile specialist; instead, learn to ask better questions. The link provided will assist you.

You did not provide:

  • What you’ve looked for to assist you solve the problem
  • Code examples that can be reproduced.

This information will be really helpful and save your fellow developers a significant amount of time in assisting you in resolving your issue.