I am working in Salesforce, configuring Named Credential and Auth Provider to access Netsuite with OAuth.
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?