Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loopback/authentication this.fail is not a function #3032

Closed
vikramkh opened this issue Jun 3, 2019 · 4 comments
Closed

loopback/authentication this.fail is not a function #3032

vikramkh opened this issue Jun 3, 2019 · 4 comments

Comments

@vikramkh
Copy link

vikramkh commented Jun 3, 2019

After following the setup for loopback/authentication, and adding the decorator: @authentication('BasicStrategy') to my users controller, I get the error:
Unhandled error in GET /users/count: 500 TypeError: this.fail is not a function
at BasicStrategy.authenticate (/Users/myName/folder/node_modules/passport-http/lib/passport-http/strategies/basic.js:69:17)
at AuthenticateActionProvider.action (/Users/myName/folder/node_modules/@loopback/authentication/dist/providers/auth-action.provider.js:55:44)

Error: 500
Internal Server Error
Unhandled error in GET /users/count: 500 TypeError: this.fail is not a function
at BasicStrategy.authenticate

Expected Behavior

Error: 400
Authentication Required

@dhmlau
Copy link
Member

dhmlau commented Jun 3, 2019

@jannyHou @emonddr, could you PTAL? thanks.

@emonddr
Copy link
Contributor

emonddr commented Jun 3, 2019

@vikramkh

Apologies for the broken example, we are in the midst of landing different PRs which
are updating @loopback/authentication .

feat: resolve authentication strategy registered via extension point landed in early May and it was a breaking change; bumping @loopback/authentication to 2.0.3.

Draft:Changes to passport strategy adapter will be updating how passport strategies are handled given the new authentication strategy interface. We are exploring a few options right now. Once things have been decided, the documentation you mention will be updated.

refactor shopping cart example to utilize latest @loopback/authentication module also landed and uses
the latest @loopback/authentication 2.0.3.

We are also in the midst of making documentation changes : update @loopback\authentication documentation (#2940).

You probably were following either of these two documents which are out of date:

https://loopback.io/doc/en/lb4/Decorators_authenticate.html

https://github.com/strongloop/loopback-next/tree/master/packages/authentication

So please stay tuned...

:)

@jannyHou
Copy link
Contributor

jannyHou commented Jun 3, 2019

@vikramkh I think you are using a passport based strategy which is not supported yet in @loopback/[email protected], we are working on the new adapter for the passport strategies in #2969, I will let you know when it's ready for use.

@jannyHou
Copy link
Contributor

jannyHou commented Jun 3, 2019

Just talked to @emonddr and seems this is the same issue reported in #2886, @vikramkh I am closing this story as a duplicate, and let's continue the discussion in the earlier issue #2886.

Feel free to reopen this issue if you have other concerns :)

@jannyHou jannyHou closed this as completed Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants