I am connecting to LIVEStream API from Adobe and have tried using both Postman and a small Python code to connect. I am using the "Client Credentials" flow and I get the access token all right but the problem comes in when I pass that access token in the request header . I have followed the guide as mentioned in GitHub, so I do not understand what am I missing:
Postman Setup
I also have this sample python code to try the connection out and even there the same problem
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
import requests
clientID="MyClientID"
clientSecret="MyClientSecret"
client = BackendApplicationClient(client_id=clientID)
oauth = OAuth2Session(client=client)
token = oauth.fetch_token(token_url='https://api.omniture.com/token', client_id=clientID,
client_secret=clientSecret)
print(token)
accesstoken=(token['access_token'])
accesstoken=accesstoken.replace('\n', ' ').replace('\r', '')
print("after trim")
bearer_token = 'Bearer ' + accesstoken
header = {'Authorization': bearer_token}
header['Accept-Encoding']='gzip'
print(header)
url = 'https://livestream.adobe.net/api/1/stream/specificStream'
r = requests.get(url, headers=header)
response = requests.get(url,
headers = {'Authorization': 'Bearer {}'.format(accesstoken),'Accept-Encoding':'gzip'})
print(response.status_code)
print(response.content)
The output is the same: 401 b'invalid authorization header\r\n'
I have followed the guide in https://github.com/AdobeDocs/analytics-1.4-apis/blob/master/docs/live-stream-api/data_requests.md
So, not sure what's missing. Has anyone seen this before? As mentioned before, I get a token alright and it's only while trying to fetch the stream do I get a invalid authorization header.