mk-5 / gdx-fireapp

libGDX Firebase API
Apache License 2.0
65 stars 21 forks source link

Fix Signin with apple, by passing correct IdToken, and validating aga… #64

Closed prateekchandan closed 1 year ago

prateekchandan commented 1 year ago

ref: https://firebase.google.com/docs/auth/ios/apple#objective-c_3

There are two issues with signIn with apple which this CR is fixing:

  1. credential.getIdentityToken() returns an object of NSData and using toString() converts it to a string which is not a valid IdToken which causes an error unable to parse ID Token

Fix: Converted it to String using byte data, and correct UTF encoding same as the ref mentioned above.

  1. With the above fix, there was issue in validating the nonce, as we are sending sha256 of nonce in request and the same in validation. But instead of sha256 we need to pass the raw nonce so the validation is done correctly.

Fix: Passed raw nonce in delegate

Testing:

  1. Validated apple login to be working