Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

App.authenticate uses wrong this reference #341

Closed
ngotoandev opened this issue Nov 4, 2016 · 2 comments
Closed

App.authenticate uses wrong this reference #341

ngotoandev opened this issue Nov 4, 2016 · 2 comments

Comments

@ngotoandev
Copy link

ngotoandev commented Nov 4, 2016

On this line, reference to this seems wrong - producing an Error.
It should be app instead.
https://github.com/feathersjs/feathers-authentication/blob/master/src/client/index.js#L30
Same for https://github.com/feathersjs/feathers-authentication/blob/master/src/client/index.js#L35

image

@daffl
Copy link
Member

daffl commented Nov 4, 2016

If you call app.authenticate the this reference will be app. You can't call the method out of context however with something like

var auth = app.authenticate;
auth();

It has to be var auth = app.authenticate.bind(app);

@ngotoandev
Copy link
Author

oh i see! thanks for the response!

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants