Search Engine: Elastic

Article ID: 133279, created on Oct 11, 2018, last review on Oct 11, 2018

  • Applies to:
  • APS 2.x

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

70bf700e0cdb9d7211df2595ef7276ab 717db81efe94e616312b74fb03a5d474

Email subscription for changes to this article
Save as PDF