Reputation: 1111
I'm using react as a frontend and express.js as a backend API server. My application should be used by users who have google emails. So I want to use Google OAuth for my app login.
I wonder how can I connect all of these react, express server, google OAuth. Are there any good resources explaining this?
user login with google OAuth, and if the user logged in the app, and a user can contact personnel data in express.js server. how can I deal with it?
Upvotes: 1
Views: 1511
Reputation: 83
I have spent some time figuring this out. It is not well documented so I wrote this article. https://medium.com/@maartendebaecke2/mern-stack-implementing-sign-in-with-google-made-easy-9bfdfe00d21c
It shows you how you can use passport.js and the passport-google-oauth2 strategy to register a user, start a session and save that user in your database. It also contains some code for a styled "sign in with Google" button.
Upvotes: 1