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

Docs for migrating to auth.hooks.authenticate hook #399

Merged
merged 2 commits into from Jan 20, 2017

Conversation

Projects
None yet
3 participants
@petermikitsh
Copy link
Contributor

petermikitsh commented Jan 17, 2017

Summary

Adds documentation for migrating from verifyToken and populateUser to new auth.hooks.authenticate hook when using a JWT strategy.

Maintainers, feel free to edit this for improvements.

Related to #396


`auth.hooks.authenticate([...strategies])`: This hook takes the place of the `verifyToken` and `populateUser` hooks.

For the JWT strategy, this hook has different behavior from the old hooks: it will return a `401 Unauthorized` error is no JWT is present in the request. Include an anonymous JWT (a JWT with no associated user) to prevent a `401` response. Anonymous JWT's can created through by externally calling the `create` endpoint of the authentication service. Internally, they can be created through `app.service('authentication').create({})`.

This comment has been minimized.

@marshallswain

marshallswain Jan 18, 2017

Member

Should "it will return a 401 Unauthorized error is no JWT" be "it will return a 401 Unauthorized error if no JWT"?

This comment has been minimized.

@petermikitsh

petermikitsh Jan 18, 2017

Author Contributor
@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Jan 20, 2017

Thanks @petermikitsh!

@ekryski ekryski merged commit bff0ec3 into feathersjs:master Jan 20, 2017

2 checks passed

codeclimate no new or fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.