DelphiWorlds / Kastri

Cross-platform library for Delphi
MIT License
480 stars 114 forks source link

Google Sign In fail to deploy only works when building the project only #221

Open pejuangdelphi opened 4 months ago

pejuangdelphi commented 4 months ago

Dear Team,

I just want to share an interesting issue that need to be fixed soon.

I tried to build project ..\Demos\GoogleSignIn and worked properly

But... when i tried to run (deploy) the project, the AndroidManifest.xml failed to be merged by your tool

I upload the screenshot to help you investigate the problem is

Thank you so much for the attention

Fail to Sign In

DelphiWorlds commented 4 months ago

It's because of a change to the build process in Delphi 12.1. The readme has been updated to add instructions on how to manually modify AndroidManifest.template.xml

pejuangdelphi commented 4 months ago

Fail to Sign In Thank you so much for the respond but still error in my IDE Delphi

I tried to merge manually with command prompt then using the result as the AndroidManifest.template and run well now

Now, the problem after try to login with gmail, i got error code 10

I have setup my Firebase project using this article

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Firebase_Android_Support

Do you have the same experience how to solve it?

DelphiWorlds commented 4 months ago

Error 10 is almost certainly an incorrect SHA1 signature value in your project configuration in Firebase Console.

As per the demo readme, you need to create a SHA1 signature for your project, as per these instructions in Grijjy's repo. Once you've created a SHA1 signature (fingerprint), go to Firebase Console, select your project, click the cog icon in the top left corner and click Settings. Select the Android app and add a signature, as per this image:

image

pejuangdelphi commented 4 months ago

Thank you so much for your best support

I have setup before and check it again and alerady the same

still get the same error code 10 Fail to Sign In Fail to Sign In 2

DelphiWorlds commented 4 months ago

I'm having the same issue now. Something might have changed in the requirements. Looking into it...

pejuangdelphi commented 4 months ago

For your information, I have sent message to Google Tim about this issue. Waiting for their respond too

Please let me know when you can solved it first and i will let you know when i can solve it

pejuangdelphi commented 4 months ago

Maybe you can use this information as the clue how to solve the problem.

https://developers.google.com/identity/gsi/web/guides/migration.

DelphiWorlds commented 4 months ago

That link is related to signing in with web applications, however it has alerted me to this regarding migrating from Google SignIn to Google Identity Services: https://developers.google.com/identity/android-credential-manager

I'm still looking into why Google SignIn is not working. Despite there being a new API, Google SignIn should still work

DelphiWorlds commented 4 months ago

I managed to get mine working again.. I expect it was because on the OAuth 2 Consent page, I had changed it to "Production". Switching it back to "Testing" seems to have fixed it:

image
pejuangdelphi commented 4 months ago

The Google Team has also responded to my email, stating that I need to add scopes and resubmit in order to activate the button for re-verification.

Untitled

DelphiWorlds commented 4 months ago

Which scopes did they suggest you add?

pejuangdelphi commented 4 months ago

You can see the response, and as an alternative, can changing the icon.

Untitled

pejuangdelphi commented 4 months ago

My OAuth consent screen is already verified.

Fail to Sign In 1

Then my app ownership has been verified.

Fail to Sign In 2

Still get error code 10

DelphiWorlds commented 4 months ago

My OAuth consent screen is already verified.

Your app is listed as being in production - are you assigning a SHA-1 signature that is from the keystore you use to sign the app for App Store?

pejuangdelphi commented 4 months ago

I use this one

Untitled

DelphiWorlds commented 4 months ago

Not sure if I can help, then. Seems you may have to ask Google.

pejuangdelphi commented 4 months ago

I still communicate with them over email and report about this issue.

Then, I also describe the steps that I already did until the last process in order for them to be easier to investigate.

pejuangdelphi commented 4 months ago

I have integrated to Firebase too.

Could you help me to check my AndroidManifest.xml

Then... I try both of these code with the same result

  1. FGoogleSignIn.SignIn('cClientID, ['email']);
  2. FGoogleSignIn.SignIn('cClientID, ['https://www.googleapis.com/auth/userinfo.email']);

AndroidManifest.zip

DelphiWorlds commented 4 months ago

If you are still receiving error 10, it is unlikely to be anything to do with your manifest. I highly suspect you are not using the correct SHA-1 value which you assign in Firebase Console, as per this reply: https://github.com/DelphiWorlds/Kastri/issues/221#issuecomment-2041279813.

I've added code to the demo which can help determine whether or not you are using the correct SHA-1, as it retrieves the value from within the app

pejuangdelphi commented 4 months ago

Thank you so much for updating the demo.

I have updated my codes using the demo as the reference to get the SHA1.

I made two options for SHA1. First for the condition where not assigned SHA1 and second condition for the assigned SHA1.

I have registered Both of SHA1 in Firebase Console too.

The final result is also the same result is error 10.

I am curious about the problem.

avitos commented 1 month ago

I am also getting error -10. True, SHA-1 is used by androiddebugkey (local and not associated with Google Play). But SHA-1 is loaded in Firebase Console.

SHA-1 matches in the application, Firebase Console and, respectively, in the Cloud Console.. Can you tell me if Google SignIn is working now?

DelphiWorlds commented 1 month ago

It works for me - I'm not sure why it does not work for you or pejuangdelphi

avitos commented 1 month ago

У меня это работает - не знаю, почему это не работает у вас или pejuangdelphi.

It's working. In my case, the problem was in the package name - it must be named by the standard “com.company.app” . I made just “com.app” for the test (and firebase treated it fine), and was getting the error.

Thanks a lot Dave!

DelphiWorlds commented 1 month ago

Thanks for letting me know!