Bearer Token header not working - 401 error

Answered

Comments

5 comments

  • 1
    Comment actions Permalink
  • Avatar
    chen

    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! 

    0
    Comment actions Permalink
  • Avatar
    chen

    Hi I tried to change the API call  using the header with the access token  from create new event to moduleInformation and it is work:

    My question is does createEvent work in bearer token authentication ??

    I would appreciate your help, thanks! 

    0
    Comment actions Permalink
  • Avatar
    chen

    Hi, until now I am waiting for your help

    I would appreciate your help, thanks!  

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello,

    My question is does createEvent work in bearer token authentication ??

    Yes, it does. API endpoints don't depend on authentication schema.

    Try to add the following parameter to requests.get method.

    allow_redirects=True
    0
    Comment actions Permalink

Please sign in to leave a comment.