Replies: 3 comments 5 replies
-
Only thing I could suggest is to recheck if you are exporting the component with |
Beta Was this translation helpful? Give feedback.
1 reply
-
You can try double-checking:
Others might be able to help if you share a minimal code base that demonstrates your problem. |
Beta Was this translation helpful? Give feedback.
4 replies
-
I solved this issue. First, in auth.tsx, get current url as follows: const router = useRouter()
const q = router.query
// ?key1=value1&key2=value2
// if no param, it becomes ""
const paramStr =
"?" +
Object.keys(q)
.map((q_key) => q_key + "=" + q[q_key])
.join("&") Then authenticate. const url = getAbsoluteURL(router.pathname + paramStr)
if (isSignInWithEmailLink(auth, url)) {
// Additional state parameters can also be passed via URL.
// This can be used to continue the user's intended action before triggering
// the sign-in operation.
// Get the email if available. This should be available if the user completes
// the flow on the same device where they started it.
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. For example:
email = window.prompt("Please provide your email for confirmation")
}
// The client SDK will parse the code from the link for you.
signInWithEmailLink(auth, "[email protected]", url) # tobe changed
.then((result) => {
// Clear email from storage.
window.localStorage.removeItem("emailForSignIn")
// You can access the new user via result.user
// Additional user info profile not available via:
// result.additionalUserInfo.profile == null
// You can check if the user is new or existing:
// result.additionalUserInfo.isNewUser
})
.catch((error) => {
// Some error occurred, you can inspect the code: error.code
// Common errors could be invalid email and invalid or expired OTPs.
})
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was wondering if it is at all possible to make a signin with email links. I successfully added the email link provider to the
FirebaseAuth
and I am also receiving the link via email. But when the link is opened the user is never authenticated. I couldn't find any explanation on how it should work or if it is considered a feature at all?!Reproducable example code
I've created a fork with a reproducable example. You can basically test the email link sign in with the
next-firebase-auth
example code:https://github.com/maerzhase/next-firebase-auth/tree/firebase-email-link-auth
Beta Was this translation helpful? Give feedback.
All reactions