-
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
[🐛🔥] @react-native-firebase/auth (phone auth) - Redirected to appScheme://firebaseuth/link after resolving recaptcha in ios simulator #7258
Comments
Try expo-router unmatched route as described https://docs.expo.dev/routing/error-handling/ and check the path name and if it matches firebaseauthlink redirect back see code sample below. function UnmatchedScreen(props: UnmatchedProps) {
const param = useGlobalSearchParams();
if (param.unmatched === 'firebaseauth,link') {
return <Redirect href="../" />;
}
return (
<View>
<Text>404</Text>
</View>
);
} |
Running into the same issue! Anyone know why it's redirecting to a deep link? Is it possible to change it? |
Same, can't find any document to customize this behavior |
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. |
Still waiting for reply 🙏🏻 |
Having this exact same issue, don't close the issue |
Same here. |
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. |
Still waiting for reply |
I'm running into the same issue. Seems to originate from the recaptcha triggered by firebase authentication that tries to redirect to app-schema://firebaseauth/link, which the expo-router catches |
This is an open source repository, all updates are visible in the form of comments here. The only updates are people asking for updates, no one appears to have the time to investigate and provide more information. If this is impacting you, allocating resources to troubleshoot it in depth is the way to move it forward |
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. |
For Expo v50 with expo-router I had to use the following: import { Unmatched, Redirect, useGlobalSearchParams } from "expo-router";
export default () => {
const param = useGlobalSearchParams<{ unmatched: string[] }>();
if (isFirebaseCallback(param.unmatched)) {
return <Redirect href="/auth/sign-in" />;
}
return <Unmatched />;
};
const isFirebaseCallback = (unmatched: string[] | undefined) => {
return (
unmatched?.length === 2 &&
unmatched[0] === "firebaseauth" &&
unmatched[1] === "link"
);
}; |
I have the same issue. |
Can we please reopen this issue? I was able to use @micaeldias 's code, but it doesn't keep the state of that screen. How can we keep the local state? |
Sure, can reopen. Please note this is an open source repository. If this is important to you, devoting resources to finding the root cause and proposing a PR is the way to get it fixed |
for those who have the same problem you just need to create a route for |
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. |
Hey @2n2n How do you maintain the state of your app? The confirmation is in state and it got lost |
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. |
Same here |
@al3xstathis while I could not replicate @2n2n's Solution, I found another that seemed to solve the problem for me. Instead of handling the OTP on /firebaseauth/link.js I just redirect backwards from that page and keep my otp on the login screen like such:
|
For me when I return to the login screen of my app the state is still lost has anyone found a solution that works since? |
This solution worked for me. Thankyou very much |
State must not be lost since screen is still exiting in route stack |
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. |
This isn't a bug, it's a way for Firebase Auth to send the user back to the app post recaptcha completion. You can customise the URL if you prefer it to have a different value: It's something like this:
either way, you'll have to handle the URL in your expo navigation once the deeplink redirects to your app after recaptcha. There is nothing to fix from RNFB side. There are a number of suggestions already in this thread that covers ways to handle this. Labelling as a documentation issue. |
SOLUTION FOUND !! AT [https://docs.expo.dev/router/error-handling/] just create a new file called +not-found.tsx at inside app. app/+not-found.tsx and inside it only have import { Unmatched } from "expo-router"; |
It's frustrating not being able to set the redirect route after solving the captcha. I didn't expect that I might have to redirect it through a hack. I've been working on this issue for a few hours now. To be honest, I thought this would be easily resolved. |
For now, I'll implement a similar solution. Here's what I did: I made a small change to my not-found page so that it redirects back directly without actually accessing the missing page. import { View, Text } from "react-native";
import React, { useEffect } from "react";
import { usePathname, useRouter } from "expo-router";
export default function NotFound() {
const pathname = usePathname();
const router = useRouter();
useEffect(() => {
if (pathname == "/firebaseauth/link") router.back();
}, [pathname]);
return (
<View>
<Text>not_found</Text>
</View>
);
} |
Worked like a charm thank you! |
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. |
Is there any update about this issue ? |
Same issue, any proper resolution. I cannot pass the confirmation back to the original view. |
This isnt working for me as the function UnmatchedScreen(props: UnmatchedProps) {
const param = useGlobalSearchParams();
if (param.unmatched === 'firebaseauth,link') {
return <Redirect href="../" />;
}
return (
<View>
<Text>404</Text>
</View>
);
} |
This worked on iOS emulator, but I am not sure how to work with routing if recaptcha is not asked.
PS: this hack is not required with React Navigation (i.e. not using expo router) |
Issue
Describe your issue here
I'm currently developing a phone authentication for my ios app using @react-native-firebase/auth specifically
Phone Auth
in ios simulator we don't have access to
Silent APNs notifications
for app verification and we will need to resolve recaptcha insteadref:
The integration went smoothly, but when I tried to resolve the reCAPTCHA on the simulator, I got redirected to appScheme://firebaseuth/link. I believe it's a deep link to that route.
Since I use expo-router, it automatically detects that link and redirected to that screen as shown in this video
Screen.Recording.2023-07-23.at.21.34.49.mov
Expected Result
It should stay with the current screen after resolving the captcha
Project Files
Javascript
Click To Expand
package.json
:firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:"@react-native-firebase/auth": "^18.3.0",
Firebase
module(s) you're using that has the issue:TypeScript
?React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: