Skip to content

Conversation

@xmaxcooking
Copy link
Contributor

  • Splits the signup and login validation and checks the dbAuthHandler signup.enabled now.
  • Adds a signup.handler for any actions after a user gets created.

can be used like this:

  const oAuthHandler = new OAuthHandler(event, context, authHandler, {
    // The name of the property you'd call on `db` to access your OAuth table.
    // i.e. if your Prisma model is named `OAuth` this value would be `oAuth`, as in `db.oAuth`
    oAuthModelAccessor: 'oAuth',
    // You can instead do `enabledProviders: {}`, but I find it more clear to be explicitly not enabling these
    // We'll enable at least one of these later on, but leave it like this for now
    enabledProviders: { apple: false, github: false, google: true },

    signup: {
      // The signup handler is called after a user has been successfully created
      handler: async (user) => {
        await sendConfirmationEmail(user.id)
        return user
      },
    },
  })

@xmaxcooking xmaxcooking changed the title feat(api): add signup.enabled and signup.handler option feat(api): add signup.handler option and check signup.enabled Oct 5, 2023
@arimendelow
Copy link
Contributor

This is awesome!! Thanks @xmaxcooking :)

@arimendelow arimendelow merged commit e81e9d6 into spoonjoy:main Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants