matthewdowney / TogglPy

TogglPy is a non-cluttered, easily understood and implemented python library for interacting with the Toggl API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate PDFs Using API Token vs Auth Credentials

zburk opened this issue · comments

I was trying getDetailedReportPDF and getSummaryReportPDF using setAuthCredentials but kept getting a 401 Bad Request error. When I switched to using setAPIKey it worked fine. Is this a known issue that API tokens must be used for certain endpoints? Happy to update the docs if this is the case.

Hmm I wasn't aware of this, but in the documentation for the reports section of the API they write:

You can authenticate in the reports API only with your API token. For HTTP Basic Auth you have to add the Authorization header with the request. The API token is the user name and the string 'api_token' is the password. Whenever possible please use the tools and interfaces provided by your http library to do Basic Auth (for example, curl uses the -u switch for that).

Pull request clarifying this would be welcome!

Thanks for the follow-up! I'll write it up