Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in response: Missing or invalid csrf_token parameter when accessing OpenRefine through API #2957

Closed
asyrul21 opened this issue Jul 18, 2020 · 4 comments
Labels
question This is a question rather than a bug or enhancement request

Comments

@asyrul21
Copy link

asyrul21 commented Jul 18, 2020

Hi OpenRefine community,

I would like to run OpenRefine in the background and communicate with it from my app through the OpenRefine API. So far, I followed instructions outlined here: OpenRefine API

I'm running Open Refine version 3.3, and attempted to upload my files through the API both from Postman and my Python App and got the response error 'Missing or invalid csrf_token parameter'. I also found another issue raised regarding the same problem, but it was already closed.

My postman request looks like this:

Screenshot 2020-07-18 at 15 24 55

Expected Behavior

I would expect the request to upload my file(s) and create a new project, as described in the documentation.

Versions

  • Operating System: Mac OS X cataline
  • Browser Version: Safari 13
  • JRE or JDK Version: 13
  • OpenRefine: 3.3
@asyrul21 asyrul21 added Type: Bug Issues related to software defects or unexpected behavior, which require resolution. Status: Pending Review Indicates that the issue or pull request is awaiting review by project maintainers or collaborators labels Jul 18, 2020
@wetneb
Copy link
Sponsor Member

wetneb commented Jul 18, 2020

Hi @asyrul21, you will need to retrieve a CSRF token before making the request with GET command/core/get-csrf-token.
See https://github.com/OpenRefine/OpenRefine/wiki/Changes-for-3.3#csrf-protection-changes for more details about this.
Because this is not a bug and working as intended, I will close this, but feel free to comment back if you need more info. In general, questions like this should go to the user or developer mailing lists.

@wetneb wetneb closed this as completed Jul 18, 2020
@wetneb wetneb added question This is a question rather than a bug or enhancement request and removed Type: Bug Issues related to software defects or unexpected behavior, which require resolution. Status: Pending Review Indicates that the issue or pull request is awaiting review by project maintainers or collaborators labels Jul 18, 2020
@tfmorris
Copy link
Member

I've updated the wiki with a link to the CSRF docs and a warning that the API is internal-only and subject to change at any time (as you've just discovered).

@asyrul21
Copy link
Author

Dear @tfmorris and @wetneb,

Thank you for your prompt response and action. I have managed to complete the POST request successfully.

Thanks!

@NamanGuptacs
Copy link

Hi @asyrul21

Will you please tell me how you have passed the csrf_token in python code

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question rather than a bug or enhancement request
Projects
None yet
Development

No branches or pull requests

4 participants