In this project we simply use the passport google Strategy. Passport is authentication middleware for Node.js. Extremely flexible and modular, Passport can be unobtrusively dropped in to any Express-based web application. A comprehensive set of strategies support authentication using a username and password, Facebook, Twitter, and more.
The Google authentication strategy authenticates users using a Google account and OAuth 2.0 tokens. The client ID and secret obtained when creating an application are supplied as options when creating the strategy.
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 need to be provided to the strategy. You will also need to configure a redirect URI which matches the route in your application.
-
Create a new project
-
Select the project and click credentials and the select OAuth client ID
-
Now Select Web Application in application type.
-
Input your app name or whatever else you like , in Authorized JavaScript origins add this line 'http://localhost:3000' and in Authorized redirect URIs field add this line 'http://localhost:5000/auth/google/callback' and the click to create .
-
Now copy your Google client ID and Google client secret.
- express
- ejs
- connect-mongo
- dotenv
- express-session
- mongoose
- passport
- passport-google-oauth20
This project has no usage other than to present future employers of my progresss as a Full-Stack Web Developer.
- Dr. Angela Yu
- Udemy