Salesforce named credential refresh token doesn't work to connect to Nestsuite

Viewed 361

I am working in Salesforce, configuring Named Credential and Auth Provider to access Netsuite with OAuth.

Named credentials

Auth Provider

In my Apex class I have:

Http http = new Http();

HttpRequest req = new HttpRequest();


req.setEndpoint('callout:Netsuite_Credential/app/site/hosting/restlet.nl?script=719&deploy=1');

req.setMethod('GET');

HttpResponse res = http.send(req);


System.debug('Netsuite: '+res.getBody());

return res.getBody();

when I save the Named Credential, the callout works, but after an hour the token expires and the callout returns "{" error ": {" code ":" INVALID_LOGIN_ATTEMPT "," message ":" Invalid login attempt. "}} ".

Is there a way for Salesforce to keep updating the tokens without expiring?

0 Answers
Related