Skip to content

feathers.js V5 How to check if user is loggedin without using authenticate hook #3107

Answered by daffl
axmad22 asked this question in Q&A
Discussion options

You must be logged in to vote

The authenticate hook is what populates the logged in user. It uses the authentication information from params.authentication to do that. You can check if authentication information has been set by looking at params.authentication. So a service method call that allows both authenticated and unauthenticated access would look like this:

find: [iff(context => context.params.authentication, authenticate('jwt'))],

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@axmad22
Comment options

Answer selected by axmad22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants