InvasionBiologyHypotheses / Documentation

Documentation related to building an open, zoomable atlas for invasion science and beyond
Creative Commons Zero v1.0 Universal
1 stars 0 forks source link

Unable to upload record data to InvenioRDM #42

Closed bootsa closed 2 years ago

bootsa commented 2 years ago

Describe the bug Posting data to the InvenioRDM API (POST to /api/records) gives a 400 bad request. (https://inveniordm.docs.cern.ch/reference/rest_api_drafts_records/)

On a local instance there is an issue with pushing through a self generated SSL certificate - though the docs say that the local instance should be running in Flask debug mode which disables enforced trusted SSL checks.

On the CERN demo instance the error returned is for a missing referer. If a referer header is given it comes back as Referer checking failed - https://localhost:3000/ does not match any trusted origins.

A missing CSRF (Cross Site Request Forgery) token error is also sometimes given - though that should only apply to fetch requests from a browser - not backend (Python or Node).

No different whether using application tokens creating in InvenioRDM user profile.

Asked in the InvenioRDM discord channel: https://discord.com/channels/692989811736182844/724974365451747329/938798216877596742

Awaiting response.

bootsa commented 2 years ago

Related to #20

bootsa commented 2 years ago

Resolved. I was using the wrong token. Need to use the Personal Access Token.

bootsa commented 2 years ago

For future ref: A bad referer error can be caused by an invalid token (as above). The InvenioRDM test site is sometimes reset - meaning all logins, uploads and personal access tokens are lost. The Referer error is misleading as it's not actually the cause or relevant.

Reported: https://github.com/inveniosoftware/invenio-rest/issues/132