How to use API tokens?

I’m trying to make an app that uses the ctfd API.
At first I tryed to use a session token to connect with the API (as the ctfd frontend does), but I found the API token in the docs. I thought this was more suitable.

I issued a token with a demo of ctfd and added Authorization: Token tokentokentoken to the header to access/api/v1/challenges. But this redirects to /login.
How do I use API tokens?

Hi! I had the same issue ([bug] Can't authenticate to the API using access token · Issue #2020 · CTFd/CTFd · GitHub). The workaround is to add the Content-Type: application/json header.

1 Like

Hi, After over a year and back to CTF again, I tried this and it works like a charm! . Thank you very much.