I've been trying to post a payload to an endpoint, the endpoint requires bearer token. using the python requests, I'm trying to post the bearer token in the header as
from requests import Session
http= Session()
accessToken = getToken(url=uri,data=payload)
authorization_header_string = 'bearer ' + accessToken
requestHeaders = {"Content-type": "text/plain", "Authorization":authorization_header_string}
headerData={"content-type":"text/plain","authorization":requestHeaders}
resp= http.post(url=uri,data=payload,headers=headerData)
but all I get is 401 error, while if I use the same token in postman it works fine. I'm using requestbin to check wherein the authorization shows up only sometimes in the header.
"Bearer " + accessToken; only field names are case insensitive for HTTP headers; values may or may not be case sensitive. - Ionut Ticus