This is my API :
And this is webstudio on teh same request url API :
{
"ok": true,
"data": {
"id": "674b3cbd06628cfaadc036cc",
"title": "TEST PATISSERIE",
"content": [
{
"children": [
{
"text": "Test 1"
}
],
"type": "h2"
},
{
"children": [
{
"text": "egfezoifilze neznifnzeifn ze"
}
]
},
{
"children": [
{
"children": [
{
"text": "rtehrthrththry"
}
],
"type": "li"
},
{
"type": "li",
"children": [
{
"text": "trehrtehrt"
}
]
},
{
"type": "li",
"children": [
{
"text": "rthrth"
}
]
}
],
"type": "ul"
}
],
"featuredImage": "674b3c8a06628cfaadc0367f",
"metaDescription": "meta description :)",
"keywords": [
{
"keyword": "patisserie",
"id": "674b3cbd5a0cad45c2e6b852"
}
],
"user": "6749ed09b65c60d02553af20",
"theme": "674b3cb706628cfaadc036ba",
"createdAt": "2024-11-30T16:26:37.573Z",
"updatedAt": "2024-11-30T16:50:55.267Z",
"authors": [
"674b416206628cfaadc0393d"
]
},
"status": 200,
"statusText": "OK"
}
What do y mean ? @TrySound
he means how did you get the data whe you compared to what webstudio gets
what's the difference? between the attachmenet and the posted data? seems the same to me
the data in the attachment seems to start at {data: {here}}
look for example in "featured Image". there are not all the children in Webstudio.
then you are not fetching the same your query must be different then between your tests
And the data I get from the attachment, I checked it in 2 ways: - On payload, in order to create the API url we can see the data we will get - By typing the API URL on Google on my server
the difference is in your queries, 100%
I have I checked and it is indeed the same url
otherwise data would be the same π
and you are not showing us your queries
π
π€£ Ok I will check again
And I will send y the queries π
Try to check the parameters depth on Payload, or try to query it on incognito to see if there is an access in your schema that relies on loggedin user
Yes you are correct, the reason comes from the fact that I am not authenticated. I'm currently looking into how to do this in Payload in fetch
Ok I need your help.
I almost managed to configure everything. This really comes from an authentication problem.
So I have the idea to use "JWT Tokens".
First I retrieve the token, and then I want to use it in my fetch request to display my blog article.
It works, but a token may change
But the problem is there, I would have liked to use the "editor expression", but in the available variables I do not have "PAYLOAD_AUTHEN". Maybe this authentication method is a bad idea?
Anyone have an idea?
is payload not providing a static token somewhere?
start using gpt for questions like this
this is what I done with the first capture
but is a JWT Token.
Paylaod not provide a static token
Is there no way to use this token like in my capture 3?
you did the second approach
first is you provide a token in your .env
payload lets you define the token
Ok sorry, I didn't understand. Ok I will test that
And I've also been using Gemini since the beginning to help me π
The easiest solution is to use api key instead of jwt
You can find on payloadcms docs to do so, by set a boolean on useApiKey on collection that have auth true
Then you can just use this user api key to access your data
yeah api key is better in your case, no need for a separate request to exchange token