User logged in but, access denied thrown by node adapter

Was creating a simple protected route in a node.js app using the node adapter. I was using the following tutorial. When the user logs in a session is created for the user in the realm, but the node server throws an error of unable to load public key and access denied message is shown in browser.
How to rectify this??