Authentication

Authentication

Authentication (Email + Social) - quick setup

Setting up auth is pretty simple here — it’s already configured in main.wasp.

javascript

    // main.wasp
    auth: {
      userEntity: User,
      methods: {
        email: {},
        google: {},
        github: {},
        discord: {}
      },
      onAuthFailedRedirectTo: "/",
    },
  

Defining auth in main.wasp lets Wasp generate the auth flow for you:

  • DB entities for credentials/sessions/social logins
  • Auto-generated AuthUI client components (see src/auth)
  • Hooks for accessing the current user

Email-Verified Auth (default)

Email auth is the default in LaunchPike.

Because verification/reset requires sending emails, you must have an email sender configured under app.emailSender in main.wasp.

Dev: Dummy Email Provider (already set)

To speed up onboarding, LaunchPike ships with a Dummy email sender: it doesn’t send real emails — it logs verification links/tokens to the server console. Check the link from the logs to verify the user and finish signup.

javascript

    // main.wasp
    emailSender: {
      provider: Dummy, // logs all email verification links/tokens to the terminal
      defaultFrom: {
        name: "LaunchPike App",
        email: "[email protected]"
      },
    },
  
⚠️

You cannot use Dummy in production. The app will not build until you switch to a production-ready provider (e.g. SendGrid).

Prod: Move to SendGrid (required for email auth in prod)

  1. Configure app.emailSender in main.wasp following this guide.
  2. Add your SENDGRID_API_KEY to .env.server.
  3. Ensure the From email in fromField matches the sender address configured in your SendGrid account.

Final main.wasp (structure as shown below):

javascript

    // main.wasp
    auth: {
      methods: {
        email: {
          fromField: {
            name: "LaunchPike App",
            // When using SendGrid, you must use the same email address that you configured
            email: "[email protected]"
          },
          //...
        },
      }
    },
    //...
    emailSender: {
      provider: Dummy,
      provider: SendGrid,
      defaultFrom: {
        name: "LaunchPike App",
        // When using SendGrid, you must use the same email address that you configured
        email: "[email protected]"
      },
    },
  

Google, GitHub & Discord (Social Auth)

Google/GitHub flows are pre-built. To enable:

  1. Uncomment the providers you want in main.wasp (methods.google, methods.github, methods.discord).

  2. Create the corresponding OAuth apps and add the keys to .env.server.

Once keys are set, Wasp wires the client/server pieces and updates the AuthUI for you.