Unauthorized access attempt. This principal does not have access to this resource

poynt.application_id = 'urn:aid:4a957130-6e39-4e7c-bae7-bd3f02a7bad9'
poynt.filename = 'testApp.pem'

poynt.env = "prod"


doc, status_code = poynt.Order.get_orders(
'51767368-5364-4d89-b04b-4502bfd1cb5f',
start_offset=0,
limit=1
)
if status_code < 300:
 print(doc)

if status_code is 200:
  print doc,"Happy"
 # do something with business
 else:
   print "Sad " ,status_code,doc

Response that I get is as follows -

Sad  401 {u'developerMessage': u'Unauthorized access attempt. This principal does not have access to this resource.', u'message': u'Access not authorized for the requested resource.', u'code': u'UNAUTHORIZED_ACCESS', u'httpStatus': 401, u'requestId': u'76075814-a878-4bb7-bd70-264a23168d66'}

Should I be changing the environment ? I did register the app and in python it was told that “token generation and refresh is done automatically, behind the scenes” . I was not able to figure out how to fix this can you please help me in doing so ?

Hi - this usually means your application doesn’t have access to the business for which you are trying to fetch the orders from. Please follow Step 8 in this document on how to obtain permissions from your own test merchant: http://poynt.github.io/developer/cloud/integrating-with-poynt-cloud-apis.html

Thanks … It works .