Open heron2014 opened 8 years ago
I just ran a clean install of this project and it worked. I cloned the repo into a new directory, ran npm install, I am on Node 5.1.1, and no problems doing the login with Postman (https://www.getpostman.com/).
Did you modify any of the code in the project or change the dependencies in the package.json to a newer version?
We haven't used Postman because we added view with the form here. package.json looks the same as ours, we only added few dependencies for view rendering. The only difference is that I am using node 4.1. I will update node and see if that might be an issue.
I'm getting the same error, running node 4.2.4.
The issue is request.auth.session.set(user), as noted by OP.... Doing a print out of the request object's '.auth' there is no 'session'. "request.auth.session" is undefined.
I also get the same error running /logout with the 'request.auth.session.clear()'. "Cannot read property 'clear' of undefined".
Any suggestions? I suspect it might be Hapi 12.1 compared to v8 in the project. I believe some stuff was removed from Hapi since then and became add-ons... But I'm not sure how to remedy.
I can confirm that the difference is in Hapi's version.
'"Starting with Hapi 12 the request.session placeholder was removed."
It is now in a plugin known as 'Yar' (https://github.com/hapijs/yar).
Using Yar I was able to overcome the login and logout errors. However, I don't believe the session is properly being set as when I go to a protected route I get a 'Missing authentication' message.
Any ideas? Thank you.
I'm submitting a pull request. I’ve made some slight modifications, as es5 to es6 style , refactoring and updating dependecies. But it retains the original idea. Now this example Hapijs work with version 12.1.0.
Hi @poeticninja. We are trying to run your example but have come across an issue where we are unable to set cookie object. We think this is where the problem is : L50
And this is the error from the console :
We hope you can help out. Thanks