0

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: sahsantoshh@gmail.com' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer e1tO5DawJq0iISdsgOk-fg'
SahSantoshh
  • 73
  • 2
  • 12

1 Answers1

0

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: sahsantoshh@gmail.com' \
--header 'expiry: 1616149988' \
--header 'access-token: sjdinlkiijklnlaosihda' \
SahSantoshh
  • 73
  • 2
  • 12