Reputation: 31
I did jwt authentication in my previous projects but never worked with oauth/passport auth before.. it's been 3 days i have been learning about passport strategies and i have implemented google+ strategy. I got new project and this project requires to let users signup/signin themselves with google or facebook or with signup-form using firstName, lastName, phone number and password..
i cant use two different approaches in one project.. like if i use jwt for signup form and cookie for google strategy how am i gonna protect my routes then? with token in headers or with cookie in browser
how can i use both in the same project?
I presented things very briefly, i hope you get it what i'm trying to do here
Upvotes: 2
Views: 451
Reputation: 14502
i cant use two different approaches in one project.. like if i use jwt for signup form and cookie for google strategy how am i gonna protect my routes then? with token in headers or with cookie in browser
You can. Cookie is just a transport mechanism for data between your browser and the server. You can store anything in it (up to allowed size limit) meaning that you can store JWT in a cookie (rather common practice especially for server side rendered single page apps).
You don't even have to develop a custom solution because this is already provided by passport in passport-jwt.
Upvotes: 1
Reputation: 336
In the scenario where you require to signup the user using predefined fields you could use something known as Local Strategy which is present in passport.passport-local
Upvotes: 0