I have followed the tutorials for adapting passport authentication strategies to Loopback 4, and have successfully gotten passport-http to work. But, when trying to get passport-ldapauth to work with loopback 4, I am consistently getting the following error Http response (using postman):
{
"error": {
"statusCode": 401,
"name": "UnauthorizedError",
"message": {
"message": "Missing credentials"
}
}
}
I have confirmed the online LDAP test server works with my setup (used a plain Express app with passport-ldapauth, with total success). Using the same LDAP config in Loopback 4, however, produces the above error.
My test Loopback app is here: https://replit.com/@woff2/CarefulGreenBits
It seems to me that I am doing something wrong with passing the verifyFn in to the AuthenticationStragegy.
Can anyone see what I am doing wrong? I have been at this for three or four days now!
It would be of great benefit to the community to solve this. I have seen many people online wanting the same auth method to work in Loopback over the past week.
UPDATE: I've narrowed it down to the request body not being processed. Whether the request body contains the username/password pair or not, the same 'Missing credentials' error results.
I found out that the username/password tuple must be passed as params on the http request. This information was contained in source-code comments of the passport-ldapauth package. Note however that when using passport-ldapauth with Express framework, passing the tuple in the request body does work.