In this tutorial, I will walk you through a complete google OAuth login with Next.js, Node, Express, Postgres, Sequelize. And in this video, we are going to be setting up our express server in Nodejs and some configurations for the google OAuth strategy with passportjs.
So how does Google Oauth flow work?
Once a user clicks on the Oauth login button, our frontend sends a request to the Google authorization server through a browser redirect and obtains an access token that will grant access to the Google API. During the access-token request, our application sends one or more values in the scope parameter which controls the set of resources and operations that an access token permits.
After obtaining the access token, what happens next?
Our application makes a call to the Google API, setting the token in the HTTP Authorization request header. The access token will be valid only for the set of operations and resources described in the scope of the token request.
Our request is authenticated using passport.js authentication and sends the user’s profile info. We will receive the user’s profile info inside a passport verify callback whose purpose is to find the user that possesses the set of credentials.
Once authentication is successful, a session is established and maintained via a cookie set in the user’s browser. Each subsequent request will not contain credentials, but rather the unique cookie that identifies the session. Passport uses the serialize and deserialize functions to save the user’s ID to and from the session.
Understanding passport Serialize and Deserialize functions
serializeUser: Determines which data of the user object should be stored in the session. The result of the serializeUser method is attached to the session as req.session.passport.user
In our case only the user ID will be serialized to the session, keeping the amount of data stored within the session small.
deserializeUser: Used to retrieve the id stored in the session by the serializeUser function. This is where we make a backend call to get the user instance by that ID and attach it to the request object as req.user.
_________________________________________________________
Source Code: https://github.com/dieudonneAwa/googl...
Google Oauth flow diagram: https://drive.google.com/file/d/1pB9s...
___________________________________________
🙏 PLEASE SUBSCRIBE FOR MORE VIDEOS 👇
https://bit.ly/3cIb4er
____________________________________________
🔮OTHER VIDEOS YOU MIGHT LIKE👇👇
▶️ Responsive Hamburger menu React: • Responsive Hamburger menu React and styled...
▶️Create Sequelize Migration and Association: • Create Sequelize Migrations & Associations...
▶️How to create an animated modal in reactjs: • How to create a nicely animated modal in R...
▶️ How to render a list of todo objects in Reactjs: • Render a list of task objects ReactJs | Be...
▶️How to setup sequelize and Postgres: • How to setup Sequelize and PostgreSQL | Be...
▶️Password Reset using SendGrid: • Password Reset using SendGrid. Best To Do ...
▶️ CRUD Operations with sequelize: • CRUD operations with Sequelize. Best To Do...
HELPFUL RESOURCES
Certified ScrumMaster Training: Get $200 off Today! Use this code SCRUM200
https://click.linksynergy.com/fs-bin/...
$2,760 in Savings: Premium PMP Exam Prep Boot Camp! Get everything you need to pass & enhance your skills
https://click.linksynergy.com/fs-bin/...
____________________________________________
Follow me on Social Media:
Facebook: https://www.facebook.com/profile.php?...
Twitter: https://twitter.com/awadieudone?s=09
GitHub: https://github.com/dieudonneAwa
Personal Blog: https://awadieudonne.com/
#googleoauth #google #oauth
KEYWORDS
Google OAuth login, google OAuth scopes, google OAuth redirect URI, google OAuth console, google OAuth consent screen, google OAuth credentials, google OAuth Nodejs, google OAuth API, google OAuth app, google OAuth API console, google OAuth app verification, google OAuth authorized domains, google OAuth authorization URL, using google earth, google OAuth button, google OAuth backend, google OAuth client, google OAuth callback URL, google OAuth consent screen localhost, google OAuth client id for google login, google OAuth client library, google OAuth developer console, google OAuth example, google OAuth email, google OAuth flow, google OAuth id, google OAuth integration, google OAuth in react, is google oauth2, google, OAuth javascript, google OAuth jwt
Watch video Complete Google OAuth with Next.js, Node, Express and Postgres | part 1 online, duration hours minute second in high quality that is uploaded to the channel FullStack Mastery 01 January 1970. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 10,268 times and liked it 103 visitors.