Unable to generate crumb cookie with Hapi/crumb

22 Views Asked by At

I've registered the crumb plugin like

register: {
  plugins: [
    {
       plugin: crumb,
       options: {
         restful: true,
         autoGenerate: true,
         cookieOptions: {
           isSecure: false
         }
       }
     }]
}

Then in the routes that I'd like to use the crumb in, I've found through the Github examples that I should be able to use it like

request.plugins.crumb.generate()

However, crumb doesn't have a method generate() when I try that...

if I log request.plugins I just see something like { crumb: random-token-here }

I can try with request.server.plugins.crumb.generate() but then I can't suppress the Typescript errors: Property 'crumb' does not exist on type 'PluginProperties'

Need help getting it to work please.

0

There are 0 best solutions below