Reputation: 73
I am trying to get current_user but non the user is authenticated by header on API request.
Header include access-token
, client
and uid
but it doesn't authenticate and shows following errors:
For reference please check this repo
Filter chain halted as :authenticate_user! rendered or redirected
Completed 401 Unauthorized in 398625ms (Views: 0.3ms | ActiveRecord: 2.6ms | Allocations: 1598457)
Response:
{
"errors": [
"You need to sign in or sign up before continuing."
]
}
Request for profile, demo endpoint
curl --location --request GET 'http://localhost:3000/tweets' \
--header 'client: TeS-DWwybwxqh9l3ZMn__A' \
--header 'uid: [email protected]' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer e1tO5DawJq0iISdsgOk-fg'
Upvotes: 0
Views: 479
Reputation: 73
The request was missing with access-token and expiry
Actual Request is
curl --location --request GET 'http://localhost:3000/tweets' \
--header 'Content-Type: application/json' \
--header 'client: TeS-DWwybwxqh9l3ZMn__A' \
--header 'uid: [email protected]' \
--header 'expiry: 1616149988' \
--header 'access-token: sjdinlkiijklnlaosihda' \
Upvotes: 0