AuthException

astegnerbsuastegnerbsu Member Posts: 4

I am able to successfully refresh token to get a new access token.

My python code extracts the new access token to place it into a _headers variable. The same _headers variable is being used in both calls immediately following each other in the code. Access token has not expired between calls.

The headers variable works going to

endpointAcct = "https://api.lightspeedapp.com/API/V3/Account.json"

ra = requests.get(endpointAcct, headers=_headers).json()

but not when going to

endpointCus = "https://cloud.lightspeedapp.com/API/V3/Account/xxxxxx/Customer.json"

r1 = requests.get(endpointCus, headers=_headers).json()

I manually updated the account number in the endpointCus variable to receive this

print(r1)

print(json.dumps(r1, indent=4))

{'httpCode': '401', 'httpMessage': 'Unauthorized', 'message': 'Invalid access token.', 'errorClass': 'AuthException'}

{

  "httpCode": "401",

  "httpMessage": "Unauthorized",

  "message": "Invalid access token.",

  "errorClass": "AuthException"

}

1 comment

  • astegnerbsuastegnerbsu Member Posts: 4

    And the problem would be the URL should be 'api.' instead of 'cloud.' for the 2nd call. Changed that, it is now working.

    Some days...

Sign In or Register to comment.