Skip to content

Authentication example is not working #2886

@b4dnewz

Description

@b4dnewz

Hi, I'm having a really hard time to implement the authorization in lb4.

I've followed the example in @loopback/authentication package and I'm getting a TypeError:

Unhandled error in GET /ping: 500 TypeError: self.fail is not a function
    at verified (project\node_modules\passport-http\lib\passport-http\strategies\basic.js:90:30)

passport-http\strategies\basic.js

  function verified(err, user) {
    if (err) { return self.error(err); }
    if (!user) { return self.fail(self._challenge()); }
    self.success(user);
  }

As far as I can tell the self.fail / self.error / self.success functions are implemented in middleware/authenticate.js and they should be defined since the BasicStrategy extend the generic strategy.

I could not find any related error in passport packages so I guess it come from the typing definitions of lb4 application.

Can someone point me the right direction to fix this? Thanks in advance.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions