This project implements login functionality using GitHub and Google OAuth with Express.js and Passport.js.
-
Clone the repository:
git clone https://github.com/mohsen104/OAuth-Passport-js cd OAuth-Passport-js
-
Install dependencies:
npm install
-
Create a
.env
file and add the following environment variables:SESSION_SECRET=<your-session-secret> GITHUB_CLIENT_ID=<your-github-client-id> GITHUB_CLIENT_SECRET=<your-github-client-secret> GOOGLE_CLIENT_ID=<your-google-client-id> GOOGLE_CLIENT_SECRET=<your-google-client-secret>
-
Run the application:
npm start
-
Open the application at http://localhost:3000.
- Go to the homepage and click on the "Login with GitHub" or "Login with Google" links to log in with your respective account.
- Once logged in, you will be redirected to your profile page.
- You can log out by clicking the "Logout" link in the profile page.