@julian said in Getting logged in user token:
_uid
Thanks for the quick response. Really appreciate the way you are responding to the user queries.
I am using point 2 to generate a token for the logged-in user using the master token.
curl --location --request POST 'http://localhost:4567/api/v1/users/2/tokens?_uid=2' \
--header 'Authorization: Bearer 840b285b-dee8-44d9-802d-a2cc0057e3ab' \
--header 'Authentication: Bearer 840b285b-dee8-44d9-802d-a2cc0057e3ab' \
response
{
"code": "ok",
"payload": {
"token": "a02c1803-9b8e-444e-892f-fef5d4ac257b"
}
}
This is working fine to get the token for a specific user. Once I get the token for the logged-in user, I am using the above response token in the further API request header as below.
curl --location --request GET 'http://localhost:3002/discussion/category/8?_uid=a02c1803-9b8e-444e-892f-fef5d4ac257b' \
--header 'Authorization: Bearer a02c1803-9b8e-444e-892f-fef5d4ac257b' \
--header 'Authentication: Bearer a02c1803-9b8e-444e-892f-fef5d4ac257b' \
--data-raw ''
But I am getting error as SESSION_EXPIRED(even though the user is logged-in in different browser)
{
"id": "app.error",
"ver": "1.0",
"ts": "2020-12-30 09:16:22:415+0530",
"params": {
"msgid": null,
"status": "failed",
"err": "SESSION_EXPIRED",
"errmsg": "Session Expired"
},
"responseCode": "SESSION_EXPIRED",
"result": {}
}