Login With Google Using React & Node - MERN Auth 2.0

  Рет қаралды 125,122

CyberWolves

CyberWolves

Күн бұрын

What's up Guys,
Today we gonna learn how to integrate google authentication in mern stack. To integrate google authentication in our application we gonna use passport module. Which is a middleware for Node JS that makes easy to implement authentication and authorization. we gonna use passport-google-oauth20 strategy because lot of people has downloaded. But to use google strategy we need to have google client id and secret key. I have covered everything in this video watch it now.
If you have doubts or suggestion to make it better please let me know in comment. If you like my work subscribe to my channel and like this video : )
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Source Code = github.com/cyb...

Пікірлер: 86
@zebedee788
@zebedee788 Жыл бұрын
Some errors you may encounter: 1. TypeError: req.session.regenerate is not a function using Passport soln: Downgrade passport to version 0.5. npm uninstall passport, npm install passport@0.5 2. Uncaught TypeError: Cannot read properties of undefined (reading 'user') soln: Pass 'user' as props directly in Home component instead of userDetails. remove line 'const user = userDetails.user' 3. Cannot GET a route. soln: add forward slash to the begining of your routes in server folder, auth.js and server.js Will add more if I find any..Happy Coding
@jayeshargade2179
@jayeshargade2179 Жыл бұрын
thank you so much
@JonathanRuiz-xu4yl
@JonathanRuiz-xu4yl Жыл бұрын
bro, you know if exist a solution to the first error without downgrading? I red that v0.5 of passport have some vulnarability issues
@ShetDeeptesh
@ShetDeeptesh Ай бұрын
thanks man.... wasted 1 week for this integration, this video is very helpful. appreciate
@tarekghosn3648
@tarekghosn3648 2 жыл бұрын
thanks for the code man. but i wish you had talked about the process for us to think better next time were connecting to an api
@samuelkusi8079
@samuelkusi8079 Жыл бұрын
Great video but i didbt see you save user into mongo as implied by the title of the video
@uboxtech
@uboxtech Жыл бұрын
req.user is undefined in production, any idea how to fix this prblm?
@videoexplore1
@videoexplore1 Жыл бұрын
Did you solved that?
@pouriarezaei625
@pouriarezaei625 11 ай бұрын
Please note that In both login and signup pages, the url should be changed to "auth/google" instead of "auth/google/callback". Thanks for the tutorial by the way.
@yashvishwakarma7907
@yashvishwakarma7907 Жыл бұрын
Honestly, Didn't liked the video. You should have to explain what code does, just little bit. Instead of pasting code, better writting
@rootbattlegrounds7948
@rootbattlegrounds7948 Жыл бұрын
You really worked hard, I appreciate that. But next time instead of pasting directly you can write the codes manually it makes it easy to catch up with the code. Try to be a little slow also when explaining.
@sajawalhassan1f12
@sajawalhassan1f12 2 жыл бұрын
If anyone got an error saying: "Error: Unknown authentication strategy "google"". Then simply import it in server.js without giving it a name: CommonJS: require("./passport"); ES6: import "./passport");
@bhavilahuja7092
@bhavilahuja7092 Жыл бұрын
Then what about the app.use(passport.initialize()) and app.use(passport.session())?
@sajawalhassan1f12
@sajawalhassan1f12 Жыл бұрын
@@bhavilahuja7092 Those lines simply initialize passportjs and its session. Importing the file sets all the configuration needed to run the functions in passportjs
@bhavilahuja7092
@bhavilahuja7092 Жыл бұрын
@@sajawalhassan1f12 Never mind, I successfully completed my task
@sajawalhassan1f12
@sajawalhassan1f12 Жыл бұрын
@@bhavilahuja7092 :)
@madhurimalviya4443
@madhurimalviya4443 2 жыл бұрын
This video was really helpful but can you please tell me how to use this login in my existing react web application?
@naqiabedi
@naqiabedi Жыл бұрын
wasted my precious time because he did not show actually if it is working or not after creating it that's the reason many guys complaining it is not working
@fullstack-user-api
@fullstack-user-api 7 ай бұрын
Hi! I have deployed the front and backend in Render! Thank you! My app works well in the localhost but in the deployment I cannot get the user after logging with gmail...I am not working with websocket but I realized I got websocket failed I do not know if that is relevant. What am I doing wrong? thank you
@sunilnoolu1508
@sunilnoolu1508 10 ай бұрын
Great work. but Explanation is too fast which makes difficult for beginners to understand.
@nwaformicah433
@nwaformicah433 7 ай бұрын
Nice video, thanks so much. I want to asked if I will add my credit card or pay to use Oauth in my project?
@jenilsatani2671
@jenilsatani2671 Жыл бұрын
using callback how to store data in database can you guide me>? and it's possible so let me know using frontend domain in google cloud console?
@reshnarajan8466
@reshnarajan8466 Жыл бұрын
I got ""The OAuth client was not found. If you are a developer of this app, see error details. Error 401: invalid_client"" while sign in with google why??? help
@faisalsaeed877
@faisalsaeed877 Жыл бұрын
did you fix it?
@reshnarajan8466
@reshnarajan8466 Жыл бұрын
@@faisalsaeed877 i referred documentation
@namansharma7531
@namansharma7531 Жыл бұрын
@CyberWolves this is not working when I host the api, its giving me success with error code 403, please help
@SunilKumar-fh6jk
@SunilKumar-fh6jk Жыл бұрын
Those who are facing response_type not provided error while logging in, add this code to the passport.js file passport.use( new GoogleStrategy( { clientID: process.env.CLIENT_ID, clientSecret: process.env.CLIENT_SECRET, callbackURL: "/auth/google/callback", scope: ["profile", "email",], response_type: "application/json" }, function (accessToken, refreshToken, profile, callback) { callback(null, profile); } ) );
@csec0565
@csec0565 8 ай бұрын
Were we making this without the help of Database ?
@rajneeshgangwar6022
@rajneeshgangwar6022 Жыл бұрын
Failed to load resources the server respond with a status of 404 (Not found) error What i shal do??
@Triwizard109
@Triwizard109 Жыл бұрын
why passport setup needs to be imported in server.js when we are not using it there?
@ki-sg9ig
@ki-sg9ig Жыл бұрын
if you're not import, code in passport file will not run😅, because npm start only start server.js file, in this file you can import to run other file
@gunpreetsingh2256
@gunpreetsingh2256 Жыл бұрын
great video! Just had a small query. What's the font and theme you are using for vs code?
@videoexplore1
@videoexplore1 Жыл бұрын
Brother, "The support of Google Sign-In JavaScript platform library for Web is set to be deprecated after March 31, 2023", after this Is there any thing new to do?
@fullstack-user-api
@fullstack-user-api 7 ай бұрын
Hi! how do I do login with facebook and github? Thank you!
@yadavkishan3778
@yadavkishan3778 2 жыл бұрын
nice bro helpful your youtub chanles
@amirrai5523
@amirrai5523 Жыл бұрын
How to create a token for this kind of Operation?
@MindOFAlfie
@MindOFAlfie Жыл бұрын
Getting a 403 error when i cloned the repo and ran the code, any ideas?
@markvitko2638
@markvitko2638 Жыл бұрын
did you fix it?
@deepanshuheer01
@deepanshuheer01 Жыл бұрын
/auth/google : route not used in this. Please help me to fix it
@pouriarezaei625
@pouriarezaei625 11 ай бұрын
You're right. You should change the URLs inside login and sign up components to "auth/google" instead of "auth/google/callback"
@sammed.sankonatti
@sammed.sankonatti 8 ай бұрын
i don't want to sing with google. You will know if you have noticed
@gautamkumarverma2929
@gautamkumarverma2929 25 күн бұрын
please tell me in detail brother,what you want to say ,so that i will not use also
@japan9169
@japan9169 Жыл бұрын
Thanks for the video. However you seem to be moving very fast in the video
@nxshipon6470
@nxshipon6470 2 жыл бұрын
Excellent content
@princebabariya-fh2dx
@princebabariya-fh2dx Жыл бұрын
Access blocked: authorisation error
@skillradius9867
@skillradius9867 2 ай бұрын
Bro had to catch train ig
@jyothinkjayan6508
@jyothinkjayan6508 2 жыл бұрын
how to redirect to front end after server side auth
@salehm5413
@salehm5413 2 жыл бұрын
Why you create passport file and does not use it ?
@CyberW0lves
@CyberW0lves 2 жыл бұрын
we have initialized passport module in that file. By importing that file in index.js every code in that file will execute. If you don't import that file it will not work.
@salehm5413
@salehm5413 2 жыл бұрын
@@CyberW0lves you dose not execute passport file in index.js
@rajilaziz8380
@rajilaziz8380 Жыл бұрын
@@CyberW0lves i do import the passport file but since it is not excute it gave error in backend terminal
@MdAzharuddin-h3u
@MdAzharuddin-h3u 3 ай бұрын
u captioned as mern but not used mongo what the hell
@breakingbad378
@breakingbad378 2 жыл бұрын
i'm not able to do it with discord
@9dwd
@9dwd Жыл бұрын
I don't want to sing with Google
@tanmayhedau5342
@tanmayhedau5342 Жыл бұрын
Don't sing then 😂
@zappist751
@zappist751 Жыл бұрын
@@tanmayhedau5342 its a joke lol
@Ravikumar-nc9bz
@Ravikumar-nc9bz Жыл бұрын
thanks was really helpful
@vaibhavgangurde2995
@vaibhavgangurde2995 Жыл бұрын
very helpful 🙏
@zappist751
@zappist751 Жыл бұрын
Hey cyberwolf, can you make a video on how to do this with mongodb?
@riteshsingh4150
@riteshsingh4150 Жыл бұрын
Arey bhai last me demo to dikha deta
@masterTimon01
@masterTimon01 Жыл бұрын
Thank you very much sir!
@leeskies329
@leeskies329 Жыл бұрын
happy singing
@hiddensoldier6770
@hiddensoldier6770 2 жыл бұрын
React is for frontend?
@CyberW0lves
@CyberW0lves 2 жыл бұрын
yes
@erhan1
@erhan1 2 жыл бұрын
you did a great job thank you so much
@breakingbad378
@breakingbad378 2 жыл бұрын
can we do the same with discord ???
@ABHAY00_7
@ABHAY00_7 8 ай бұрын
Great Help !!
@anuragdixit3581
@anuragdixit3581 Жыл бұрын
title mai yha react kyu likha ?
@yrama4714
@yrama4714 6 ай бұрын
thankyou bro
@mangeshpandit4660
@mangeshpandit4660 Жыл бұрын
THANK YOU
@chandrashekharjoshi6907
@chandrashekharjoshi6907 Жыл бұрын
@alanye7542
@alanye7542 2 жыл бұрын
thanks!
@prodev08
@prodev08 Жыл бұрын
thnx❤
@Abundify
@Abundify 3 ай бұрын
apne mera sara code khrab krdia
@ayushbhatt2352
@ayushbhatt2352 3 ай бұрын
mera bhi krdia 😭😭😭😭
@hariharanmohan273
@hariharanmohan273 2 жыл бұрын
thank you. its working
@kamichikora6035
@kamichikora6035 2 жыл бұрын
i am getting No routes matched location "/undefined/auth/google/callback" ...I'm i doing something wrong?
@kunaljethva9623
@kunaljethva9623 2 жыл бұрын
You need to Replace the process.env with the Localhost port i faced the same issue, because in the video in the video sir have used .evn file
@kamichikora6035
@kamichikora6035 2 жыл бұрын
@@kunaljethva9623 thank you, I'll try that
@mansinagaria2034
@mansinagaria2034 Жыл бұрын
@@kunaljethva9623 could u please clear this again im getting same error
@WizowskiTheCow
@WizowskiTheCow Жыл бұрын
thank you I had the same issue
@akashsuryavanshi7026
@akashsuryavanshi7026 Жыл бұрын
@@WizowskiTheCow bro, How did you solve this problem?
@RA-ks5wt
@RA-ks5wt Жыл бұрын
Time waste, too many errors, a big thumbs down.
@kshitizsachan7196
@kshitizsachan7196 Жыл бұрын
this video is a fraud please don't wase time watching it, it does not teach how to actually implement google auth fully.
NodeJS & Express - Google OAuth2 using PassportJS
20:33
Kris Foster
Рет қаралды 107 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 60 МЛН
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 9 МЛН
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 7 МЛН
Add Google OAuth 2.0 Login for React in 5 minutes 2024 (Easy Method)
4:33
Tutorial - Login with Google using Passport.JS in a MERN Web Application
16:11
Google Identity Services Login with React (2023 React Google Login)
19:50
I built the same app 10 times // Which JS Framework is best?
21:58
Fireship
Рет қаралды 2,6 МЛН
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 9 МЛН