-
-
Notifications
You must be signed in to change notification settings - Fork 328
Description
Hi,
React.js: i have a google login button, that looks something like this
const GoogleButton = () => (
<a href='/auth/google' >
<div className='google-icon-wrapper'>
<img className='google-icon' src= {googleLogo} alt='Google logo'/>
</div>
<p className ='google-btn-text'>
Sign in with google
</p>
</a>
)
React.js (http-proxy-middleware) in development mode i also have proxy settings
const proxy = require("http-proxy-middleware");
module.exports = function(app) {
app.use(proxy("/auth/", { target: "http://localhost:5000/" }));
app.use(proxy("/api/", { target: "http://localhost:5000/" }));
};
Node.js : I have this endpoint, and it doesn't work on production since the proxy does not work on the production
app.get('/auth/google', passport.authenticate('google', {
scope: SCOPE,
access_type: 'offline',
})
);
The problem is, I have React-PWA that caches the link on the production and accordingly the passport cannot authenticate the user..
Go to the page below, click the google link, and you'll go to the page ../auth/google, but if you go to the development tools => application => clear storage, click "clear site data" and then click again login to Google, it will work. .
https://passport-google-auth.herokuapp.com/
Environment
MERN stack
- Operating System: macOS
- passport version: ^0.4.1
- passport-google-oauth version: "^2.0.0"