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

Best practice to authenticate Using Passport and passport-google-oauth2 without using any type of session? #90

Open
kamit-transient opened this issue Jan 30, 2023 · 4 comments

Comments

@kamit-transient
Copy link

Hi Team,

I read through many materials but didn't find any proper ones to be used.

Here is the Use case:

I implemented Google Auth2 login/singup using Passport & passport-google-oauth2, and I am not using any type of session instead I am using JWT token to exchange the details from server to React application and vice-versa.

From the frontend(ReactJS) I want to login using google login by calling my expressjs API.

I see people using either window.open or <a href="pathe to passport API for google authentication"> Login </a> to call their server API which redirects to the google login page, and then they use an established session to fetch user details then on.

But the above approach won't work if we use JWT, where API needs to return its own token to the client side once google login cycle is complete in the same single flow.

So what is the best approach to implement google auth using passport and passport-google-oauth2 from reactJS when we use JWT and not Session?

@official-commandcodes
Copy link

Based of current information on passport,that's impossible.It is a must to use session.

@nntwelve
Copy link

nntwelve commented Jul 3, 2023

Hello guys, I am facing with the same issue! Is there any update for it?

@ankitbibiyaan1992
Copy link

hey guys, I am facing the same issue. Is there any workaround?

@nntwelve
Copy link

nntwelve commented Aug 10, 2023 via email

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

4 participants