Skip to content

This is the repo for my blog post on How to Implement Authentication in Node JS with Passport & JWT. You can find the article at https://jacquesikot.hashnode.dev/how-to-implement-google-login-in-node-js-with-passport-jwt-and-typescript

Notifications You must be signed in to change notification settings

jacquesikot/passport-google-oath-tut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Passport-Google-Oath-Tutorial

This is the repo for my blog post on How to Implement Authentication in Node JS with Passport & JWT. You can find the article at https://jacquesikot.hashnode.dev/

Installation

First of all, you need to get your GOOGLE_API_KEY & GOOGLE_API_SECRET from your google cloud console. To do this, login to your google cloud console. On the the top navigation bar, create a new project and name it. When this is done, navigate to the project dashoard, and on the side navigation go to APIs & Services > Oath Consent Screen. Setup the details of your consent screen, once done, navigate to APIs & Services > Credentials, create new Oauth credentails and get your API key and secret. create a .env file from the sample.env file provided, pass any random string as JWT_KEY and use PORT = 3000 then run:

npm install

Usage

Once the dependencies are installed, run:

npm run watch

after that, in a new terminal, start your development server with:

npm run dev

To login or signup a new google user open your web browser and run http://localhost:3000/api/auth/google. You will be redirected to the callback URL, and the user object and jwt token will be returned.

Contributing

If there is any way you can contribute to this code base, Pull requests are welcome.

About

This is the repo for my blog post on How to Implement Authentication in Node JS with Passport & JWT. You can find the article at https://jacquesikot.hashnode.dev/how-to-implement-google-login-in-node-js-with-passport-jwt-and-typescript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published