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

Enhancement/Enable token authorization for API calls #317

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

c-w
Copy link
Member

@c-w c-w commented Aug 1, 2019

As discussed in #299, there is desire to interact with Doccano via the API since this enables integrating Doccano with others systems, e.g. fetch data from system A, push it into Doccano, and later sync the labels to system B.

In order to facilitate usage of Doccano via the API, this pull request adds token authentication to the API:

# fetch an auth token once for non-interactive usage of the API
curl 'http://localhost:8000/v1/auth-token' -d '{"username": "user", "password": "pass"}' -H 'Content-Type: application/json'

# at a later point, can use the auth token to interact with the API
curl 'http://localhost:8000/v1/me' -H 'Authorization: Token xxxxxxxxx'

@Hironsan Hironsan merged commit b190a79 into doccano:master Aug 20, 2019
@c-w c-w deleted the enhancement/api-auth branch August 20, 2019 11:45
@kechan
Copy link

kechan commented Apr 28, 2022

I tried:

curl 'http://localhost:8000/v1/auth-token' -d '{"username": "user", "password": "pass"}' -H 'Content-Type: application/json'

But failed, among the message:

You are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked by third parties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants