I've begin working with Named Credential and Authentication Provider for the first time and I'm a bit lost on the authentication process and the refresh token functionalities.
I'm going to add to my managed package this named credential in order for our subscribers to authenticate to their service and allow us to make some callouts to it.
- My first question is, can I trigger the authentication flow from another point (e.g: Visualforce page) other than setup? I don't want my subscribers to go to Setup > Security > Named Credentials > Edit > Save in order to start this process.
- How can I get the access token and 'update' the Name Credential every N days to renew it before it expires?
Notes:
- After I ran the authentication flow the name credential displays the following message
The authentication provider didn't provide a refresh token. If the access token expires, your org won't be able to access this named credential.
- I'm integrating with Square and they say I need to renew the access token every 30 days by making a call to
POST /oauth2/clients/{client_id}/access-token/renew