SahSantoshh
SahSantoshh

Reputation: 73

Can't authenticate user by its token, Filter chain halted as :authenticate_user! rendered or redirected

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."
 ]
}

Header Response on sign_in: enter image description here

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

Answers (1)

SahSantoshh
SahSantoshh

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

Related Questions