Skip to content

Duplicate requests causing verification token to be invalidated #7363

Answered by aaly00
michaelhays asked this question in Help
Discussion options

You must be logged in to vote

We are sending the user to a page that redirects the user to the magic link after a settimeout. This mitigates the need to create a token with no expiration date. This option should probably be built into next-auth.

You create a page like the one we have /auth/magiclink?redirect= with the redirect param set to the actual magic link. Then in your page you decide what logic you want to use. You can force the user to click a button, do an auto redirection after a set timeout, or both. You probably also want to check to make sure you're not creating an open redirect vulnerability in your redirection page.

 EmailProvider({
    async sendVerificationRequest(params) {
        const {

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@ejeatstofu
Comment options

@michaelhays
Comment options

@aaly00
Comment options

Answer selected by michaelhays
@michaelhays
Comment options

@albertsikkema
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants