Thanks man, this method is perfect when req.user is undefined after user login (by google, github or other services). I trying to solve req.user undefined before 2 days now today it is work for me.🙂🙂
what about the logout .does the logout means we have to delete the entries for the db of the loggedin user ? , also want the behavour of the logout here
Great explanation! You helped a lot. But I have a question, if I am planning on deploying the app, would I need 2 domains? One for the react frontend and another one for the backend? Or how would the redirect work?
Thank you. I've learned a lot. Can you tell me how to customize strategy by passport-oauth2,I want to use passport-oauth2 custom policy to do the system
@@SaltyBoi420 Hi! I'm having the same problem. There is no session on the front-end side. My Backend request is trying to set cookies (I can see it in the headers), but ends up failing to do this. Have you solved this problem?
@@alexvolkov529 Hi mate, yes i have solved it, so we cannot pass/set a cookie from A domain to B domain imagine we can do that internet will be a mess. So i use my backend on subdomain.A.id and my frontend on A.id and i can pass my jwt as cookie from backend to frontend, but only work on firefox. I believe it is an user agent (browser) problem. Cheers👍
The two codebases should be merged into one. The frontend and backend should be run under the same webserver, using just one port, so there should be no CORs policies needed...
I have a problem with the window.closed. the newWindow object is changing to global for somereason so the newWindw.closed attribute is set to true like 200 ms after it opened even if it's still not closed. it seems to be a problem with the domain becasue when I use a webpage with localhost:3000 it works. Any workaround for this ? why is your code working out of the box ?
@@KingTom777 Same thing was happening to me. Because you were able to figure out it came from helmet, i went through the helmet middlewares to figure out which one was causing the issue. It is coming from helmet.crossOriginOpenerPolicy(). If you change the policy for this one, it will solve the issue: app.use( helmet({ crossOriginOpenerPolicy: { policy: "unsafe-none" } }) ); To answer your question, I don't know why his code worked out of the box without this workaround.
Actually, this seems like it should be the default policy. So it makes sense that it would work for everyone else, but I can't figure why mine would be different.
Finally a great explanation ! Thank you , A question I'm using jsonwebtoken in my email/password signup so after i wanted to add google SSO , is it okay to use the jsonwebtoken instead of passport.deserializeuser ?
After researching a lot, I have finished watching your videos two times because your explanations are so good. Thanks
ditto
Thanks man, this method is perfect when req.user is undefined after user login (by google, github or other services). I trying to solve req.user undefined before 2 days now today it is work for me.🙂🙂
Thank you very much for this contribution, it helps me a lot to start with passport and the backend, congratulations
Very Cool Video! Keep up with good work. I look forward to another nice contents.
Man, thank you so much. You helped me implementing google login in my next app. Ty!
Your channel is amazing!
Great Explanation, Highly Recommended.
Seriously man You are awesome.. Just saved my day! Keep it up the good works❤️
won't the user disappear after page refresh ?
which keyboard are you using?
what about the logout .does the logout means we have to delete the entries for the db of the loggedin user ? , also want the behavour of the logout here
BROOOOOOOOOOO U SAVED ME I LOVE U
I like the video tutorial, thanks.
Great explanation! You helped a lot. But I have a question, if I am planning on deploying the app, would I need 2 domains? One for the react frontend and another one for the backend? Or how would the redirect work?
No, you don't need two domains, but I'm not sure how to redirect.
You don't need 2 domains.
You can use subdomain instead.
Thanks for this video I had watch so many but this one was the most detail and clear 🙏
I loved this tutorial!! Thank you!!!
You saved my day !!! cheers
true hero, indeed!
Can I use it for my react native application? . Do I have to remove the redirect url or what should I do
how can we access mobile number and address through when we make profile of user??
how your popup google window is closing ?
Thank you. I've learned a lot. Can you tell me how to customize strategy by passport-oauth2,I want to use passport-oauth2 custom policy to do the system
what if I had to make this (API with Google SSO) for two client apps
i.e. React website & React-Native Mobile App
Very informative :)
callback url doesn't store user data in req. Can you help me?
can I do the same step in the ember js framework? will it work?
Reply ASAP
Great tutorial and it helps a lot. Can you help me on how I can use azure ad instead of google? Thanks
I don't get user info from backend after logging in.. why do you think it is?
Have your cookies stored on the frontend?
This is oauth login only not a sso.
Sso and oauth are different concepts
not work in production
i got no session after log in, probably because of different domain
@@SaltyBoi420 Hi! I'm having the same problem. There is no session on the front-end side. My Backend request is trying to set cookies (I can see it in the headers), but ends up failing to do this. Have you solved this problem?
@@alexvolkov529 Hi mate, yes i have solved it, so we cannot pass/set a cookie from A domain to B domain imagine we can do that internet will be a mess. So i use my backend on subdomain.A.id and my frontend on A.id and i can pass my jwt as cookie from backend to frontend, but only work on firefox. I believe it is an user agent (browser) problem. Cheers👍
@@SaltyBoi420 Yes, thank you! It makes sense!
@@alexvolkov529 i can provide you the project for reference if you want. But you know the problem is on production level😂👍
Very helpful
Thanks a lot for this, cannot tell you how helpful this was
thanks for this
y r u using sql. Cant setup cus of it
Thank you
make video on infinite scroll like instagram post, and skeleton loading screen. In MERN please
How many of you think he looks like Andrew Garfield(the actor in Amazing spiderman)
The two codebases should be merged into one. The frontend and backend should be run under the same webserver, using just one port, so there should be no CORs policies needed...
In the real world (i.e, a job), the separate server approach is much more common, for reasons like scalability and ease of deployment.
In real life, they separate the code bases :)
please buy a new mic and fix that echo...
I have a problem with the window.closed. the newWindow object is changing to global for somereason so the newWindw.closed attribute is set to true like 200 ms after it opened even if it's still not closed. it seems to be a problem with the domain becasue when I use a webpage with localhost:3000 it works. Any workaround for this ? why is your code working out of the box ?
The problem was helmet middleware for some reason.
@@KingTom777 Same thing was happening to me. Because you were able to figure out it came from helmet, i went through the helmet middlewares to figure out which one was causing the issue. It is coming from helmet.crossOriginOpenerPolicy(). If you change the policy for this one, it will solve the issue:
app.use(
helmet({ crossOriginOpenerPolicy: { policy: "unsafe-none" } })
);
To answer your question, I don't know why his code worked out of the box without this workaround.
Actually, this seems like it should be the default policy. So it makes sense that it would work for everyone else, but I can't figure why mine would be different.
Finally a great explanation ! Thank you , A question I'm using jsonwebtoken in my email/password signup so after i wanted to add google SSO , is it okay to use the jsonwebtoken instead of passport.deserializeuser ?