signInWithEmailLink cannot sign in on web layer
See original GitHub issueI am trying to log the user on the native + Web layer … but the following only seems to log me into the native layer. The following example is from the docs found here Using Javascript SDK
const signInWithEmailLink = async () => {
// Get the email if available. This should be available if the user completes
// the flow on the same device where they started it.
const emailLink = window.location.href;
// Confirm the link is a sign-in with email link.
const result = await FirebaseAuthentication.isSignInWithEmailLink({
emailLink,
});
if (
result.isSignInWithEmailLink
) {
let email = window.localStorage.getItem('emailForSignIn');
if (!email) {
// User opened the link on a different device. To prevent session fixation
// attacks, ask the user to provide the associated email again.
email = window.prompt(
'Please provide your email for confirmation.',
);
}
// The client SDK will parse the code from the link for you.
const result = await FirebaseAuthentication.signInWithEmailLink({
email,
emailLink,
});
// Clear email from storage.
window.localStorage.removeItem('emailForSignIn');
return result.user;
} else {
alert('emailLink is invalid.');
}
};
Additional context:
Been looking through the firebase SDK docs … but haven’t found a solution for this problem. Im assuming we need to create a credential with the email & emailLink and then login … but haven’t found the correct docs for this.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Authenticate with Firebase Using Email Link in JavaScript
To complete the sign in on landing page, call signInWithEmailLink with the user's email and the actual email link containing the one-time code....
Read more >Firebase UI does not work with Safari on Mac or iPhone ...
1. On our webpage app the behaviour seen is -. Select Login from our menu and the Firebase UI renders correctly. Select the...
Read more >Using Firebase Authentication - FlutterFire
Anonymous sign-in provides an extra layer of security if using Firebase Firestore, Realtime Database or even an external API, since you're able to...
Read more >capacitor-firebase/authentication - NPM Package Overview
If the user should also be logged in on the web layer (for example ... link is a sign-in with email link suitable...
Read more >firebase signInWithEmailLink method not working properly
import { signInWithEmailLink } from "firebase/auth"; const [email, setEmail] = useState(""); const ... Sign up using Email and Password.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You are right. Seems like this example is not for the Firebase JS SDK docs. Please try the following:
(@trancee Did we mix things up here?)
@gerardopar That’s great, thank you! I will update the docs. Let me know if you have any more questions.