coolishbee / universal-sdk-unity

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

Sign-in with Apple missing nonce #26

Closed dlorddd closed 11 months ago

dlorddd commented 1 year ago

What did you do?

I was implementing the Universal SDK Apple Sign-In with Firebase Authentication.

What did you expect?

I wanted to retrieve the nonce that is generated for the sign-in request as it is required to link credentials with Firebase.

What happened actually?

I am not 100% sure but I think the nonce is not given back?

Your environment?

--probably not relevant

Screenshots or Log

Reference to the Firebase nonce generation chapter: https://firebase.google.com/docs/auth/ios/apple

coolishbee commented 1 year ago

The universal sdk issues a nonce internally, but it is not provided because it is data that does not need to be provided to the user. Also, it is unrelated to firebase auth and cannot be linked with firebase auth as a universal sdk apple login function. However, there is no problem if both are used at the same time.

dlorddd commented 1 year ago

It is possible to use Apple auth results to link an identity in Firebase. This requires (in the case of Apple) the nonce. Below a short snippet of how I use it (currently with a different plugin):

var authResult = SomeOtherSDK.LoginWithAppleId();
Firebase.Auth.Credential credential = Firebase.Auth.OAuthProvider.GetCredential("apple.com", authResult.AppleIdToken, authResult.RawNonce, null);
auth.CurrentUser.LinkWithCredentialAsync(credential)

I think it should be quite beneficial but it could also be the case that I misunderstood something.

coolishbee commented 1 year ago

For Android, return url (callback url) is important. However, the method I provide is not compatible with the callback url provided by firebase. I tried several times because it was requested by other developers, but failed. I agree it would be beneficial too. 😢

Thank you so much.