Complete Login with Google in Node.js, OAuth & MySQL 🔥

Complete Login with Google in Node.js, OAuth & MySQL 🔥

T
Thapa Technical
Apr 24, 2025

Welcome, In this video, I’ll show you how to create Login with Google in Node.js using Express, Arctic OAuth, and MySQL (Drizzle ORM). We'll go step-by-step — from creating a Google OAuth client ID to securely storing user data and tokens. Whether the user is new, already registered, or just using Google for the first time, we cover it all!

👉 This tutorial is beginner-focused (even for class 10th students) and helps you understand how real-world login systems work using Google Sign-In.

📺 Watch the complete Node.JS Playlist here :https://youtube.com/playlist?list=PLwGdqUZWnOp3KELplHtc-RnJ5xTUPqdgH&si=_ob8F88HYxCdspup

🔥 Access Source Code, PPT & Notes here for Free : https://www.thapatechnical.com/2024/11/introduction-to-nodejs.html
------------------------------------------------------------------------
🚀 Boost Your Skills with these Pre-Requisite Videos:

🔗 Best HTML Course - https://youtu.be/5ccq_nLHneE
🔗 Best CSS Course - https://youtu.be/MSICFljRcb4
🔗 JavaScript Basics Course Part 1 - https://youtu.be/13gLB6hDHR8
🔗 JavaScript Advanced Course Part 2 - https://youtu.be/YwsOCN8woA8

------------------------------------------------------------------------
💸 Build Your Own E-commerce Website for Free! - https://www.thapatechnical.com/2024/03/build-complete-ecommerce-website-using.html

------------------------------------------------------------------------
✌️ Join Us!

🚀 Become a Member: Unlock perks, free source code, and more Join Now : https://www.youtube.com/channel/UCwfaAHy4zQUb2APNOGXUCCA/join
📷 Connect on Instagram: https://www.instagram.com/thapatechnical
🗨️ Join Our Discord Server: Hang out with fellow programmers Discord Link: https://discord.gg/MdScmCsua6

------------------------------------------------------------------------

⌛TIMELINE⏳
0:00 - Intro to Login with Google in Node.js and MySQL
0:50 - How Login with Google Works (Explained Simply)
3:25 - Understanding OAuth Table Design
4:50 - Initial Setup Before User Logs In
9:00 - Quick Intro to MySQL Live Classes
9:53 - Creating OAuth Client ID in Google Console
13:00 - Adding Client ID & Secret in .env File
14:20 - What is State, Code, and Authorization URL?
18:05 - Creating OAuth Table Schema in MySQL
21:25 - Installing Arctic and Adding Google Login Button
22:50 - Generate State, Code, and Auth URL with Arctic
28:00 - Google Class Setup and Environment File
31:00 - Redirect to Google Login Page
32:52 - Creating Google Callback Route
34:30 - Verifying State and Code with Cookies
38:05 - Getting User Info from Google Login
39:10 - 3 Must-Know Things Before Proceeding
41:00 - Case 1: User Already Exists with Google Login
45:30 - Case 2: User Registered Manually, Not with Google
48:08 - Case 3: New User Logging in with Google
48:50 - What is Transaction in MySQL?
51:30 - Insert User Data in Both Tables Using Query
53:00 - Adding Session, Access, and Refresh Tokens
53:50 - Generate and Migrate OAuth Schema
55:00 - Fixing Password Field Error
58:10 - Final Google Login Testing
58:50 - Outro and What’s Next