I`m working on project that contains 2 apps: web-site and chrome extension. Web-site technologies stack: Nodejs, Mongoose, React.
For now, I`m trying to realize authentication via Google+, using Passportjs. Why Passportjs ? Because I want to use many authentication flows.
First of all, I make a simple auth flow with login and password:
Why token? Because in chrome extension I need authentication too.
Look at my code: (files in this gist)
LogIn realization:
local-login.js file
SignUp realization:
local-signup.js file
I have a login page, which makes AJAX request to server with login and password:
LoginPage.jsx file
When I tried to make authorization via Google I experienced some problems.
My Google authorization code:
google-login.js file
How I must return token to client? (for saving in localStorage) And, where I can get the right token? accessToken(parameter in passport callback) - is it that what I need?