Google Auth with Nextjs 14 app directory

Published: 29 May 2024
on channel: Digital CEO
353
3

CONNECT ON MY DISCORD COMMUNITY:
  / discord  

Note: When you receive the profile info from Google via the id_token, decode it and save the user's info in your own cookie or database. If you save and rely on the direct id_token jwt value for future profile info like I did in the tutorial, remember it will expire, requiring additional checks to re-fetch it. An easier way is to store the user's name and profile photo links in your database unless you want to refresh profile info from Google more frequently.

0:00 intro
0:38 Demo
2:36 Create Google Project
4:00 Google Auth Api route
9:18 Google Sign in Button
10:14 Google Tokens
12:34 Create Login Cookie
14:00 Google Profile Token
15:28 Check if user is Logged in
17:00 Header Profile Photo
20:28 Logout Button/Route
23:00 Re-use saved user token on logins
27:00 Some points

SOCIALS:
Twitter:   / omarel  
Website: https://www.omarel.com
LinkedIn:   / omarelbaga  
GitHub: https://github.com/oelbaga


Watch video Google Auth with Nextjs 14 app directory online without registration, duration hours minute second in high quality. This video was added by user Digital CEO 29 May 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 35 once and liked it people.