LaunchPad.js
Authentication

Socials

Secure your SaaS application with ease. This guide covers authentication with socials

Getting Started

You get the LaunchPadjs with the default Google and Github providers.

providers: [
    GoogleProvider({
      clientId: process.env.GOOGLE_CLIENT_ID ?? '',
      clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? ''
    }),
    GitHubProvider({
      clientId: process.env.GITHUB_CLIENT_ID ?? '',
      clientSecret: process.env.GITHUB_CLIENT_SECRET ?? ''
    })
  ]

For using them first you need to create an account in Google and Github developer console and get the client id and client secret.

Update the client id and client secret in the .env file.

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=

Connect to a database to store the user's session and user's information.

You can use any database that is supported by Prisma. For quick setup you can connect to a Postgresql database using Docker as instructed in the Database Setup section.

Update the schema as your requirement in prisma/schema.prisma file.

Now run the following command to create the auth tables in the database.

npx prisma migrate dev

It will ask you to provide a name for the migration. Provide a name for the migration. It will create a new migration file in the prisma/migrations directory.

It will also generate a prisma/client file for you to use the database in your application. If it doesn't generate you can generate it by running the following command.

npx prisma generate

That's it for the setup. You can now start the development server by running the following command.

npm run dev

On this page