coolishbee / universal-sdk-unity

The Universal SDK for Unity provides a modern way of implementing Social Login APIs.
45 stars 11 forks source link

Google Login on Android not working while exporting .aab with split application binary #23

Closed eriol24 closed 1 year ago

eriol24 commented 1 year ago

Hi, I am facing problems on Google Login with Android only.

I think my setup is correct because .apk is working as expected.

But when it comes to .aab with split application binary on, Google Login returns 7002 Login Failed(10) to me.

Is that something not being handled while exporting .aab with split application binary on ?

Thank you.

coolishbee commented 1 year ago

Hi,

The difference between apk and aab is irrelevant.

The certificate fingerprint used when building must be registered in firebase or google api console.

For more information, please refer to the issue #2.

Thanks!

eriol24 commented 1 year ago

Thanks for the reply.

For now, I can assume these setups are configured correctly because .apk works, right?

So the main difference is Firebase.

I find that I have missed your guide about adding both app signing & upload certificate key, sorry about that.

I add it back, download and import the latest version of services json file, I still get the same error code and message.

By the way, I have imported the firebase unity plugin before using this plugin, don't know if impact or not.

Thanks again.

coolishbee commented 1 year ago

Registering the certificate fingerprint through the Firebase console is just to use the Google API console easily. In other words, you can register the certificate fingerprint in Google API console instead of Firebase.

Therefore, there is no conflict between universal sdk and firebase sdk.

Thanks!

eriol24 commented 1 year ago

Do you mean that I can remove all SHA-1 from firebase console,

then create OAuth Client using my package name and Upload / App Signing SHA-1 ? (Which one)

And then replace the value in this line ? resValue("string", "google_web_client_id", "value")

So it still works if I use Android Application type of OAuth2, instead of Web application ?

Sorry for not familiaring with Google/Android stuffs.

coolishbee commented 1 year ago

Do you mean that I can remove all SHA-1 from firebase console, then create OAuth Client using my package name and Upload / App Signing SHA-1 ? (Which one)

In the simplest terms, the upload key certificate is used before the app is released to the store, and the app signing certificate is used after the app is released to the store. Therefore, multiple registrations are possible.

And then replace the value in this line ? resValue("string", "google_web_client_id", "value") So it still works if I use Android Application type of OAuth2, instead of Web application ?

Yes, Android must be registered as a Web application type to work. I don't know why. But every time I build, even if the certificate changes, the value doesn't change.

Thanks!

eriol24 commented 1 year ago

It finally works! But actually I don't know why.

My steps are here :

That's really weird, I haven't change anything from Unity side.

Thanks for the help by the way.

coolishbee commented 1 year ago

congratulations it works 🎉

Even if you delete the certificate (ex. sha-1) from the firebase console, it doesn't matter because it exists in the Google API console. Among the generated titles, auto created by Google Service is that.

Thanks!