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

Questions regarding authentication with PingID #2

Open
rtm619 opened this issue Apr 2, 2019 · 0 comments
Open

Questions regarding authentication with PingID #2

rtm619 opened this issue Apr 2, 2019 · 0 comments

Comments

@rtm619
Copy link

rtm619 commented Apr 2, 2019

Hi,
I have a few questions regarding the OAuth flow with Ping.

  1. Does passport-ping-oauth2 save any data on ClientSide after login is successful?
  2. Do we need express-session to maintain session?
  3. What is the best way to log out and delete session?
  4. What is the best way to authenticate routes?
  5. Is it necessary to have a separate DB to store user data or just the OAuth call is enough?

Please get back to me with the details as soon as possible.

Following is my server.js code. I am using NextJS with Ping OAuth.

server.get(
      '/',
      passport.authenticate('oauth2', {
        scope: ['openid', 'profile', 'email'],
        idp: 'OAuth',
      })
    );

    server.get(
      '/dashboard',
      passport.authenticate('oauth2', { failureRedirect: '/login' }),
      function (req, res) {
        // Successful authentication, redirect home.
        res.redirect(
          url.format({
            pathname: '/home',
            query: {
              userId: req.user.sub,
            },
          })
        );
      }
    );

    server.get('/home', function(req, res) {
      const userId = req.query.userId;
      app.render(req, res, '/home', { userId });
    });

    server.get('/logout', (req, res) => {
      req.logout();
      res.redirect('/');
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant