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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.
I've been grep'ing around for a while and l couldn't find the related code. (I searched for userId, entity, _id)
Is the doc wrong?
I'm looking for this because when I call app.service('/authentication').create({payload: {userId: _id}, jwt: {expiresIn: '10m'}}) I have to specify the payload part ({payload: {userId: _id}) otherwise the userId will not be set.
The text was updated successfully, but these errors were encountered:
Are you able to make this call from the client or is it on the server?
Normally the user id is set in a before/authentication hook as the migration document shows:
// Authenticate the user using the a JWT or
// email/password strategy and if successful
// return a new JWT access token.
app.service('authentication').hooks({
before: {
create: [
auth.hooks.authenticate(['jwt', 'local']),
customizeJWTPayload()
]
}
});
The local strategy will take the username and password submitted to /authentication, look it up in the database, verify the password and will then update the payload for the JWT that is created accordingly.
Hum ok I just realized that it doesn't make any sense to have the jwt strategy insert the userId automatically, since I'm calling the authentication endpoint on the server side there's no way for it to get the userId by it self.
The migration doc says:
I've been grep'ing around for a while and l couldn't find the related code. (I searched for
userId
,entity
,_id
)Is the doc wrong?
I'm looking for this because when I call
app.service('/authentication').create({payload: {userId: _id}, jwt: {expiresIn: '10m'}})
I have to specify the payload part ({payload: {userId: _id}
) otherwise theuserId
will not be set.The text was updated successfully, but these errors were encountered: