-
Notifications
You must be signed in to change notification settings - Fork 127
Fix PhoneAuthOptions Timeout overflow on some platforms #1360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
❌ Integration test FAILEDRequested by @AlmostMatt on commit cd6c183
Add flaky tests to go/fpl-cpp-flake-tracker |
| ## Release Notes | ||
| ### Upcoming Release | ||
| - Changes | ||
| - Auth (Android): Fixed an issue where VerifyPhoneNumber's internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this actually occur to a developer using our SDK? Would it always fail or only if they specified a timeout? Probably best to describe this from the developer's perspective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was reported by a developer in firebase/firebase-unity-sdk#764.
I tried to phrase the readme description similar to the error message that was shown to the user.
I think it would always fail. VerifyPhoneNumber takes a PhoneAuthOptions which always has a timeout milliseconds field. Regardless of what they set (0 or 60 seconds), it would still overflow to some invalid value and the user gets an error.
That said, when I tested our C++ integration tests VerifyPhoneNumber succeeded even without this fix. I think this must be something like a different compiler that uses 32 bits for a long, and therefore no overflow occured. So the issue might be specific to Unity users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok. So maybe add "with certain compiler settings" to the end of the explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Description
On some platforms there was previously an issue with the code to convert TimeoutMilliseconds from uint32_t to java long, causing it to become a negative value and then getting rejected by Android validation.
Example: firebase/firebase-unity-sdk#764
I was able to reproduce the original issue with the Unity Auth testapp, which calls VerifyPhoneNumber with a PhoneAuthOptions.
The visible error was: "VerifyPhoneNumber: builder faild to create PhoneAuhtOptions"
Looking into the android logcat, the internal error was: "We only support 0-120 seconds for sms-auto-retrieval timeout"
This change should fix this by having an explicit cast from uint32_t to jlong before passing the timeout into the java long constructor. This should make the code work regardless of whether jlong is a 32 bit or 64 bit number.
Testing
I verified the fix by building the unity sdk with this change included and running the Unity auth testapp. VerifyPhoneNumber ran successfully on my device.
Type of Change
Place an
xthe applicable box:Notes
Release Notessection ofrelease_build_files/readme.md.