Skip to content

Elsoberanold/fastify-passport-session-example

Repository files navigation

Fastify Passport Session-auth Example

How to run this example?

  1. Run Yarn or NPM to install required packages

  2. Create a .env file on the root of the folder with the following vars:

# API PORT
API_PORT=4000

# Frontend PORT
PORT=5000

# Prisma
DATABASE_URL=file:./db.sqlite

# Next Auth Discord Provider
GOOGLE_CLIENT_ID= {paste here google client id}
GOOGLE_CLIENT_SECRET= {paste here google client secret}
  1. Change App.tsx file to match API_PORT defined on .env file:
const API_URL = `http://localhost:${4000}`
  1. Regist your app on Google Cloud Platform https://www.passportjs.org/tutorials/google/register/

Set up on Authorized JavaScript Origins:

http://localhost:{API_PORT}

Set up redirect uris:

http://localhost:{API_PORT}/api/auth/callback/google
  1. Setup prisma: Run:
npx prisma db push
npx prisma generate

To run the App:

Start API:

yarn dev:api

or

npm run dev:api

Start Frontend:

yarn dev

or

npm run dev

Known Issues

Despite the fact that this code is fully working on Mozilla Firefox, the same was not completely achieved on Microsoft Edge.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published