Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Forbidden 403: Authentication Unsuccessful - Salesforce Integration

Started by Nico nico.varley@morganking.co.uk -   in API Authentication

Xero was set up and working with our Salesforce org, but the developer has left and it stopped working.

I have seen that he set up the Auth Provider and Named Credentials, so it seemed like he used an OAuth 2.0 app and deleted that.

I set up an OAuth 2.0 app on Xero, I set up the Auth Provider the same as he had done and modified the named credentials. They opened up Xero and asked me to allow access. So, it looks like it worked!

When we make API callouts like:
(With <contactID> and <tenantID> being proper IDs, I'm not sure if it could be sensitive info so I'm omitting it)

```
HttpRequest request = new HttpRequest();
request.setMethod('GET');
request.setEndpoint( 'callout:Xero_Environmental/api.xro/2.0/Contacts/<contactID>');
request.setHeader('Accept', 'application/json');
request.setHeader('xero-tenant-id', '<tenantID>');
HttpResponse response = new Http().send(request);
```

The response that gets returned is:

{"Type":null,"Title":"Forbidden","Status":403,"Detail":"AuthenticationUnsuccessful","Instance":"c74dbb1e-32ff-4ad2-bce8-72e365a43567","Extensions":{}}

What am I doing wrong? I feel like I've exhausted every similar thread!