-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[🐛] Android 13 SMS Code Has Expired, for every 13 device after release not able to verify #7344
Comments
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
You are overriding the firebase BoM, that's for advanced use cases and you assume the risk of breakage. It may be the cause of this. Have you tried removing it, updating to react-native-firebase current and letting it handle the BoM resolution as it will do for you here:
Also, I do not believe this is necessary, the auth package will bring it in for you, so this should be removed from your gradle files along with the BoM entry
It does not appear that there were auth-related issues, however, you never know, and first job of reproduction is to make sure you're not just discovering old bugs, so you want to get on current software That said, I do not see any issues in the upstream firebase-android-sdk repo about this, and the last time I saw this it was more related to using the wrong SMS code - usually a subtle issue where somehow multiple SMS codes may be requested, then there is a race condition, and the wrong one is used. Perhaps that is it, or similar to it? No one else is reporting this and Android 13 has been out for a while though, so even though I don't have concrete evidence of it I would strongly suspect this is a project-specific issue |
Hi @mikehardy , @andymatuschak @felixclack @dlackty |
This comment was marked as spam.
This comment was marked as spam.
Hello @mikehardy @andymatuschak @felixclack @dlackty , I found the root cause of the issue:- The issue is with Android 13. When we try to set up accounts using a SIM card and create new accounts, the device generates an invalid OTP error. It will function well if we try to use a different cellphone number.
|
Hello @mikehardy , @andymatuschak @felixclack @dlackty ,
|
This comment was marked as spam.
This comment was marked as spam.
Hello @mikehardy , |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Hi there, with apologies, that is not how open source works - there is no ability to demand emergency solutions, and open source development is not responsive to commercial deadlines of people using the freely provided software. I refer you to this:
It is imperative to understand the implications of that, which is that you are the developer of the software, not the consumer. If there is a problem that is affecting you and there is insufficient responsiveness from others, you must dedicate the resources to fix the problem. I am also just a developer of the software, alongside you. I am willing to help others but I am not obligated in specific cases. I have mentioned above specifically that I do not reproduce this. I will also note and emphasize very strongly that OTPs in general are lossy. A specific example: SMS messages may fail delivery at the carrier level for a variety of reasons, in my personal experience with an app in Ecuador some numbers that were recently ported between carriers and all numbers on one specific carrier were simply not delivered ever. For that reason, my strong advice is: You must not rely on OTP as an exclusive means of authentication. You need a backup. At which point this is no longer an emergency for you. Following that, I suggest you pursue this with a minimal reproducible example in firebase-android-sdk based on their quickstart to show them the problem as they will have to resolve it if you can reproduce it. |
As a separate moderation note: do not repeatedly tag people in your comments without advancing the topic (through personal effort at demonstrating a reproduction or developing a solution). Some of your comments have been reported (fairly, in my opinion) as spam and I will close those comments as such. |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
Those are old versions. I have been tagged again but there is no extra logging or reproducible example that advances the issue So the previous 2 comments are the equivalent of an otherwise not useful '+1', except they are worse, they indicate an unwillingness to test the current release and report results on it. |
hi @mikehardy as i can see some other projects has same issue, also as you know we already share all techical details by@ReactNativeDev2296. If you handle this issue ( i am sure it ll easy to get action this kind of changes from your team ) we ll glad. Thanks. |
Have you tried on current versions? |
@mikehardy Android 13 works perfectly with Recaptcha, without Recaptcha but not with it (previous version 18.3.1) or the current version. |
Your statement seems to read like it works great with and without recaptha. Do you have an app.js I could use to reproduce? |
firebase sdk tries to auto verify user after msg is received . is there any way to disable auto verify ?? |
Hi @mikehardy , Please check the below code for more information componentDidMount() {
this.subscriber = auth().onAuthStateChanged(this.onAuthStateChanged);
}
componentWillUnmount() {
if (this.subscriber) {
this.subscriber(); // Unsubscribe on unmount
}
}
onAuthStateChanged = (user) => {
if (user) {
}
}
async callFirbaseAuth(phone: any) {
await auth().signInWithPhoneNumber(phone)
.then(async res => {
Toast.showWithGravity("OTP sent successfully", Toast.SHORT, Toast.BOTTOM)
this.setState({ isLoading: false, phoneValue: phone })
this.props.navigation.replace("Verification", { number: this.state.phoneValue, authConfirmation: res, verificationauthres: res, data: 'LOGIN' })
}).catch(error => {
this.setState({ isLoading: false })
let temp = error.toString()
if (temp.includes("auth/too-many-requests")) {
alert("Something: " + temp);
Toast.showWithGravity("Something went wrong", Toast.LONG, Toast.BOTTOM)
this.setState({ isLoading: false })
}
})
}
async verififyOTP(){
try {
await this.state.verificationauthres.confirm(this.state.OTP).then(async (val: any) => {
this.setState({ OtpLoader: false, isLoading: false, })
}).catch((error: any) => {
console.log("LOG verifyFirebase", error.toString());
Toast.showWithGravity("Invalid verification code" + '', Toast.LONG, Toast.BOTTOM)
this.setState({ isLoading: false, OTP: "" })
})
} catch (error) {
this.setState({ isLoading: false })
}
} index.js import { AppRegistry } from 'react-native';
import { name as appName } from './app.json';
import { App } from './App';
const snapshots = false;
if (snapshots) {
require('./indexSnapshot');
}
else {
AppRegistry.registerComponent(appName, () => App);
} |
hi @mikehardy again please check this post ↑↑↑ : #7344 (comment) |
@mikehardy any news here ? |
My work app was quite out of date, so this took a while With up to date react-native and react-native-firebase on an Android 13 phone, I was able to successfully use phone auth with an sms code sent by firebase So, I still don't reproduce this and I strongly suspect there is some app-specific implementation detail causing this to happen for you |
Your "example" is not a reproducible example by the way - it is not minimal, and it is not complete - it includes references to Toast, navigation, state, some indexSnapshot thing, all sorts of things that make it so it does not actually run and may not be used as proof of anything Creating an example is a vital skill when requesting help. Here's the philosophy, please understand it: https://stackoverflow.com/help/minimal-reproducible-example For your example I would expect an index.js that does nothing but load App.js, and an App.js that does nothing but
Don't worry about loading state or whatever, just use a simple alert to display results of function calls, you are having an emergency problem right? Simplify things down to their minimum. |
Got Any Solution for this ? |
@ajaymangal7 have you read the comment immediately above yours? We need more information from an affected person. Your comment does not supply more information, so no progress towards a solution yet. |
Hey Guys, I believe I was able to find out the root cause of this issue. TBH I'll have to say it is not a bug, it is a feature 😅. @mikehardy please confirm on this. If we go through the Firebase's official documentation for Phone Auth on Android then they have mentioned,
Here is the link to this, https://firebase.google.com/docs/auth/android/phone-auth#onverificationcompletedphoneauthcredential And it seems like RNFirebase uses this SMS Retriever API too, So what really happens here is that on some latest Android devices when the SMS is received, the above mentioned SMS Retriever API automatically reads the code and uses it to authenticate / login the user to the app. This all happens in the background and if we have not handled the scenario, the app won't get to know about it. Now when user manually enters the code, and as that code was already consumed in the background, it now says that Code has Expired. You can confirm this from the Firebase's Authentication console as it will show the timestamp for the user Signed In, even if it said that code expired. The simple solution to handle this is put onAuthStateChanged listener in your Enter OTP Screen,
It will get called when the user is authenticated automatically and you can continue from there as per your app's flow. |
Yes, I believe we document the Examine the comment in the sample code on same: https://rnfirebase.io/auth/phone-auth#sign-in |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Just in case someone lands here from google land, I created a PR that can disable auto verify so devs can handle OTP manually |
Hello @mikehardy, @andymatuschak , @gilbertl @dlackty @felixclack
I am unable to log into any Android 13 device, please provide a solution
**Library version:
**Build.gradle file(Android):
***Build.gradle(android/app):
The text was updated successfully, but these errors were encountered: