Symptoms

Any requests to the APS REST API fails with 403 error if oAuth authorization is used.

Cause

oAuth authorization requires HTTPS protocol to operate as described in the documentation.

Resolution

In order to make it work, we have to create the brand and send the request via HTTPS protocol to the brand URL.

E.g. create the brand "cats.tld", add this record to the hosts file and use the following script to send request:

from requests_oauthlib import OAuth1Session

# Enter input parameters:
consumer_key = 'DJ0wWDJarXbzK5iITucFkmcUGWfCrcsY'
consumer_secret = 'zkRDUTA1V8GFdbvkViWnk3PvITcvz***********InTYs5VyJNMO8ZQL6UVof2Nu6g'
url = "https://cats.tld/aps/2/resources/"

# Set session parameters and get response:
session = OAuth1Session(consumer_key, consumer_secret)
response = session.get(url, verify=False)
print response.text

Internal content