-
Hello, this is more a doubt than a proper issue. I am buliding a feature for users to edit some of the custom User fields (name, avatar). After succesfully editing, I want to rebuild the token with the new fields and attach the access token to the response request, so the frontend can grab the token after the update action and properly syncronize these fields in the client. I thought that I could use the method
The token is being generated with the right custom fields updated, and the token is being attached to the request, so I can grab it in the client. The problem is that all the requests being make with this new token result in 401 error. What I am missing?. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
@egimenos Try passing the 2nd argument to the method E.g. |
Beta Was this translation helpful? Give feedback.
-
@egimenos If you don't mind, can you please share some info about why you are generating a new token when old one is still valid? Do you have any data of user encoded in the token which will be used in other requests? |
Beta Was this translation helpful? Give feedback.
-
@egimenos FYI, I have converted the issue to a discussion. |
Beta Was this translation helpful? Give feedback.
@egimenos Try passing the 2nd argument to the method
create_token_and_set_header
as'user'
instead ofUser
, it should work.E.g.
create_token_and_set_header(current_user, 'user')