Skip to content

Email Provider Link Expiring even though set a max age #7434

@haseeb090

Description

@haseeb090

Question 💬

Hey Folks

I'm using NextAuth and it's Email Provider for authentication. Everything is great except for one issue.

Our email link expires after 24 hours. The info on the next auth docs is that we should overwrite the maxage parameter in the provider. I have set it to 365 days however it is still expiring after 24 hours.

Following is my email provider code(Happy to provide more code if you want):

EmailProvider({   
      server: {
        host: process.env.EMAIL_SERVER_HOST,
        port: process.env.EMAIL_SERVER_PORT,
       
        auth: {
          user: process.env.EMAIL_SERVER_USER,
          pass: process.env.EMAIL_SERVER_PASSWORD,
        },
        
      },
      maxAge: 365 * 24 * 60 * 60,
      from: process.env.EMAIL_FROM,
      sendVerificationRequest({ identifier, url, provider }) {
        CustomsendVerificationRequest({ identifier, url, provider })
      },
    })

This is a problem we're facing since most of our customers don't login until 2-3 days later.

How do we extend the email link expiration?
Any kind of help would be greatly appreciated

Thanks

How to reproduce ☕️

Setup a next auth project
Setup Email provider
Setup CustomsendVerificationRequest
Set Maxage to whatever you want in Email

Contributing 🙌🏽

No, I am afraid I cannot help regarding this

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsk how to do something or how something works

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions