Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWA and auth link #142

Open
JimHolman1199 opened this issue Aug 16, 2020 · 0 comments
Open

PWA and auth link #142

JimHolman1199 opened this issue Aug 16, 2020 · 0 comments
Labels
question Request for help or support

Comments

@JimHolman1199
Copy link

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"
@jaredhanson jaredhanson added the question Request for help or support label Dec 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Request for help or support
Projects
None yet
Development

No branches or pull requests

2 participants