docs: add Content-Type header for JWT authentication (#12513)
### What? Fix docs fragment about JWT strategy authentication ### Why? The example in docs doesn't work out of the box <img width="535" alt="image" src="https://github.com/user-attachments/assets/ae62b89e-25bd-4d50-b64f-f0edb4f40ca7" /> Solution is to set `Content-Type: application/json` <img width="819" alt="image" src="https://github.com/user-attachments/assets/4e645576-071d-436d-a5e2-eaa9e218f855" />
This commit is contained in:
@@ -23,6 +23,9 @@ Example:
|
|||||||
```ts
|
```ts
|
||||||
const user = await fetch('http://localhost:3000/api/users/login', {
|
const user = await fetch('http://localhost:3000/api/users/login', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
email: 'dev@payloadcms.com',
|
email: 'dev@payloadcms.com',
|
||||||
password: 'password',
|
password: 'password',
|
||||||
|
|||||||
Reference in New Issue
Block a user