Error while depositing record: CSRF token missing or incorrect. #194
|
I have the following issue as illustrated by this reprex: zenodo <- zen4R::ZenodoManager$new(
token = keyring::key_get("ZENODO_SANDBOX"),
sandbox = TRUE,
logger = "DEBUG"
)
rec <- zenodo$createEmptyRecord()
#> ✖ Error while depositing record: Permission denied.
#> [zen4R][ERROR] ZenodoManager - Error while depositing record: Permission denied.Created on 2025-10-02 with reprex v2.1.1
|
Replies: 2 comments 1 reply
|
CSRF token is not managed by user. Zenodo API provides you a token for usage in the API, and you should stick with this token (Be careful with the kind of reply you could get from AI which may get you on wrong paths) The API returns you a "permission denied", with a status code 403 Forbidden. This means your token doesn't exist or doesn't allow for deposit. BTW, You have shared a debug report that shows headers, and then your token was exposed. I've masked it, but I would advise you delete that one and generate a new one. You need to make sure:
The Zenodo sandbox is likely to be unstable, and by experience, there might be unexpected and random issues with this test infra due to Zenodo infra testing or because of temporary regressions. This said, I've just generated a token on the sandbox and tried to create an empty record with zen4R, it worked. |
|
Thanks for the quick reply. And sorry for the noise. I must have done something wrong before, because when I deleted the old token and created a new one, everything seems to work as expected. |

CSRF token is not managed by user. Zenodo API provides you a token for usage in the API, and you should stick with this token (Be careful with the kind of reply you could get from AI which may get you on wrong paths)
The API returns you a "permission denied", with a status code 403 Forbidden. This means your token doesn't exist or doesn't allow for deposit. BTW, You have shared a debug report that shows headers, and then your token was exposed. I've masked it, but I would advise you delete that one and generate a new one.
You need to make sure: