-
Notifications
You must be signed in to change notification settings - Fork 290
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
Token Based Auth #16
Comments
Hi @amirhemm, which library are you refering too? Or is this that you are trying to implement your own token base auth? By token base, do you mean sending a token via Header? |
Hi @hoangvvo, for example if you want to setup Jsonwebtoken library and maybe pass the token inside of the header or inside of the cookie. Or maybe use a third party authentication service like auth0. |
@amirhemm Yes, that is certainly possible. However, the way this project set up is to use session Id. If I'm free this weekend, I will try to cook something up. Feel free to ping me in this issue this weekend if I forget. However, a hint is to look into https://github.com/hoangvvo/nextjs-mongodb-app/blob/master/middlewares/withAuthentication.js That is our whole authentication logic. We are reading a value from session ( |
This is easy to implement with the latest version with Check out /lib/passport.js. You will need to plug in passport-http-bearer In the middleware, you want something like: middleware.use(passport.authenticate('bearer', { session: false })) Feel free to ask me to reopen this if you have any trouble |
Is there a way that we can use token based auth with library? I love the way you have used the new API routes in next js 9!
The text was updated successfully, but these errors were encountered: