This repository contains an implementation of Google OAuth2 authentication using Express.js. The application is structured with TypeScript and demonstrates how to use Passport.js with the Google OAuth 2.0 strategy to authenticate users.
This project showcases how to integrate Google OAuth2 authentication in an Express.js application using TypeScript. The application includes user authentication via Google, session management, and redirects users upon successful login.
To get started with this project, follow these steps:
-
Clone the repository:
git clone https://github.com/Athulkrishna-S/Authentication-Google.git
-
Install dependencies:
npm install
- Go to the Google Developers Console.
- Create a new project.
- Enable the "Google+ API" for the project.
- Create OAuth 2.0 credentials (Client ID and Client Secret).
- Set the Authorized Redirect URI to
http://localhost:3000/auth/google/callback. - Update the
.envfile with your Google OAuth2 credentials.
To run the application, execute the following command:
npm start