Bearer Token header not working - 401 error
AnsweredHi,
I'm trying to do API calls using Bearer auth for cloud users.
I did all the following steps as mentioned in your documentation.
All steps were completed successfully and I also checked that I got the excepted output.
I'm using python requests.
I got the Bearer token that was returned from the API call (/cdb/oauth2/token) and put it in the headers.
My request looks like this:
-
Hello,
Please, try our python example on GitHub.
-
Hi,
Thanks for the quick reply!
I have already gone through your code, still not working for me, so I tried it by myself as follows:
1. Obtain the session token from the Cloud by OAuth2, using POST /cdb/oauth2/token request.
The output I got is:
As you can see, this response is correct.
2. I took the access token value from the returned response, and put it inside a dictionary that contains the header. This dictionary variable looks like this:
3. I did an API call for create new event, using the header with the access token:
As mentioned in my first post, when we did this API call with Digest auth, it worked good, so there is no problem with the API URL or with the params.
4. After the create event API call, I printed the response content, and I got the following output:
I would appreciate your help, thanks!
Please sign in to leave a comment.
Comments
5 comments