Skip to content

firebase auth Given link is not a valid email link. #6715

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

Closed
Willham12 opened this issue Feb 24, 2025 · 8 comments
Closed

firebase auth Given link is not a valid email link. #6715

Willham12 opened this issue Feb 24, 2025 · 8 comments

Comments

@Willham12
Copy link

We created an issue on react-native package and have found out that the apiKey is required on android but not on ios. The function isSignInWithEmailLink is not checking if an apiKey is provided. As you can see we are checking if the given email link is an signin email link before we are signin with email link.

Let me know if you need more questions.

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@mikehardy
Copy link

@Willham12 just a note - in react-native-firebase we implement - in javascript! - the same check that firebase-js-sdk performs, and it does not check for apiKey. We are not currently in our official implementation calling through to firebase-android-sdk's isSignInWithEmailLink method.

You state "As you can see we are checking if the given email link is an signin email link before we are signin with email link" but from a firebase-android-sdk perspective this is not completely correct since that method is not called.

However, I know you were testing a change to react-native-firebase where you did in fact call firebase-android-sdk's isSignInWithEmailLink - is that true? Does it verify the apiKey URL param or not?

@Willham12
Copy link
Author

The firebase android sdk not checking if api key param is provided.

@lehcar09
Copy link
Contributor

Hi @Willham12, I tried reproducing the behavior you raised and I wasn't able to encounter the issue. The isSignInWithEmailLink check fails, when the apiKey does not exist in the email link.

Could you share an MCVE and steps to reproduce and clarify the issue?

@Willham12
Copy link
Author

What i do is to call this function with this example link: https://<domain>?mode=signIn&oobCode=${route.params.oobCode}
It return true but this function throws an error that the provided link is not an valid link. If i add the apiKey param to the link it not fails. On IOS it seems that the apiKey is not required. The function signInWithEmailLink without apiKey param not fails.

  String emailLink = "https://<domain>?mode=signIn&oobCode=<oobCode>";
  if (firebaseAuth.isSignInWithEmailLink(emailLink) {
     firebaseAuth.signInWithEmailLink("[email protected]", emailLink)
 }

@lehcar09
Copy link
Contributor

The Firebase Native Android SDK does check for the apiKey in the email link.

com.google.firebase.quickstart.auth  I  Email Link: https://<PROJECT_ID>.firebaseapp.com/__/auth/links?link=https://<PROJECT_ID>.firebaseapp.com/__/auth/action?mode%3DsignIn%26oobCode%<SOME_OOBCODE>%26continueUrl%3Dhttps://<PROJECT_ID>.firebaseapp.com/%26lang%3Den
com.google.firebase.quickstart.auth  I  isSignInWithEmailLink: false

As mentioned in this comment .

@Willham12 just a note - in react-native-firebase we implement - in javascript! - the same check that firebase-js-sdk performs, and it does not check for apiKey. We are not currently in our official implementation calling through to firebase-android-sdk's isSignInWithEmailLink method.

This issue is best handled by the React Native Firebase team. That said, I'll be closing this issue now. Let me know if there's any misunderstanding so we can re-open the issue. Thanks!

@Willham12
Copy link
Author

@lehcar09 can you please try with this link "https://google.com?mode=signIn&oobCode=testCode"?
in our case we are using not the link provided by auth package.

@mikehardy
Copy link

@Willham12 there appears to be a misunderstanding if you want firebase-android-sdk team to try that link. Why? Because they have already confirmed to you that they check if apiKey is in the link:

The Firebase Native Android SDK does check for the apiKey in the email link.

So your test will fail, and they have told you it will fail, on firebase-android-sdk.

In firebase-js-sdk and firebase-ios-sdk it will pass. This is a platform difference, but not something firebase-android-sdk needs to address per se. As they said, there is no issue here.

In react-native-firebase we need to check on android platform if apiKey is in the email link and fail if not

@firebase firebase locked and limited conversation to collaborators Mar 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants