Skip to content

PWA and auth link #142

@JimHolman1199

Description

@JimHolman1199

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionRequest for help or support

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions