Like what we’re doing? Star us on GitHub!

How to set expiration limit for forgotpassword token ?

Veera26
4 weeks ago
6

How to change expiration limit for forgot password token from 1 hour ?

  • thisisnotchris
    4 weeks ago

    @Veera26 According to the source, the options for forgotPassword are as follows:


    export type Arguments = {
      collection: Collection
      data: {
        email: string
        [key: string]: unknown
      }
      disableEmail?: boolean
      expiration?: number
      req: PayloadRequest
    }


    reference:

    https://github.com/payloadcms/payload/blob/master/src/auth/operations/forgotPassword.ts


    Lucky for you, the default is one hour



      user.resetPasswordExpiration = expiration || Date.now() + 3600000; // 1 hour
  • Veera26
    3 weeks ago

    OKay thanks



    I will look into it

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More