Some required authorization strategies for hapi.js?

I have a hapi server that saves credentials for logging into a session cookie using the node module "hapi-auth-cookie". I use a “call” so that certain functions can be authenticated using Facebook.

In the Facebook authentication handler, how do I access session information from a session cookie, when you can still access the information calls me from Facebook?

+4
source share
1 answer

There is a problem in the call repository with the proposed solution for use server.auth.test(). Like this:

request.server.auth.test('strategy-name', request, (err, credentials) => {
  if (err) {
    // tested strategy didn't find a user
    return reply({ error: 'Cannot find your credentials' })
  }

  //there is a user :)
  return reply({ status: true, user: credentials.name })
})

Hope this helps and gives direction :)

+1
source

Source: https://habr.com/ru/post/1598108/


All Articles