Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How to install google oauth on passport.js?


Asked by Harleigh Harper on Dec 04, 2021 OAuth 2.0 Series



Passport.js and Passport Google OAuth 2.0 strategy installed . To check if they have been installed, run the following command in the terminal. If they have been installed, the result will be similar to the following. If the result is empty, run the following command in your terminal to install them.
Besides,
Befo r e using passport-google-oauth20, you must register an application with Google. If you have not already done so, a new project can be created in the Google Developers Console. Your application will be issued a client ID and client secret, which needs to be provided to the strategy.
Just so, Google supports authentication with both oAuth 1.0 and oAuth 2.0. The Google OAuth 1.0 authentication strategy authenticates users using a Google account and OAuth tokens.
And,
So, You need to follow below steps once you open Google API Console: From the project drop-down, select an existing project, or create a new one by selecting Create a new project In the Credentials tab, select the Create credentials drop-down list, and choose OAuth client ID. Under Application type, select Web application.
In addition,
Passport strategy for authenticating with Google using the OAuth 2.0 API. This module lets you authenticate using Google in your Node.js applications. By plugging into Passport, Google authentication can be easily and unobtrusively integrated into any application or framework that supports Connect -style middleware, including Express.