I am performing a rest callout to a 3rd party service. Authentication is set up with a named credential (Named Principal, OAuth2) using an Open ID Connect-authentication provider which uses WSO2 identity server.
Initially, callouts from apex code work fine, until the token expires after 24hrs. Then I am consistently receiving below error:
{"message":"unauthorized request, please refresh your access token","statusCode":401,"error":"Unauthorized"}
The only "workaround" is to start the OAuth Flow again using the "Start Authentication Flow on Save"-setting in the named credential.
Does anybody have an idea what the issue could be? This question is similar to question( Named Credential - Automatic refresh token does not work with WSO2 Identity server) but no response on that question too?
Scope
attribute asrefresh_token
. Is theScope
attribute configured this way in your Named Credential configuration?