#API works in browser but throws 403 on Postman

1 messages · Page 1 of 1 (latest)

honest cloud
#

I'm attempting to use the REST API outside of the browser but there are many questions.

  1. How do you use the User's API-KEY in the authorization header? There is no documentation on that.
  2. Every request from Postman returns 403: Forbidden even through the same request work in the browser there the same user is logged in. It doesn't even seem to reach API key authentication and is immediate.

I there proper documentation on how to actually use the API which seems to be an important feature of PayloadCMS?

prisma muskBOT
polar steeple
#
 headers: {
      Authorization: `JWT ${token}`,
    }
  });

@honest cloud

replace token with the one your received from login endpoint.

honest cloud
#

I would like to use the User API key shown in the admin dashboard.

honest cloud
polar steeple
#

for those API keys, header value is different

const response = await fetch('http://localhost:3000/api/pages', {
  headers: {
    Authorization: `users API-Key ${YOUR_API_KEY}`,
  },
})
honest cloud
#

I see, yes that works finally.