I have checked many times and the clientid and clientsecret are the same as those provided by the api. the redirectURI is also the same.
I have also tried both API versions 1 and 2 I get the same error either way.
How can I stop getting 401 errors?
(the code has been copied straight from README.md on the github repo.
Code:
I noticed a slight difference between the api page and the github repo as the api page said to use version 0.1.1 and the github repository said to use 0.4.2. I selected version 0.4.2 in pom.xml as I was following the guide on github.
The api page I was referencing: API Reference (just in case there is some other one that is more up to date that I have missed)
That repo may not be up to date. Try making a call to that endpoint through curl (or any other command line util or any online util) and see if your call and tokens have any issues. If not, then the library in the repo may be the problem.
I’ve done some more testing (firstly starting with shell commands) and it turns out the repository works correctly from my testing,
But the readme.md file skipped the step of getting the user code for the token request. I cannot find where that is done within the API so I have just written a custom HTTPSRequest to do it. Everything after that point appears to work as expected