I have setup an auth provider with Open Id Connect.
It works well but I have an issue when I want to refresh the token.
I'm using this line to get a token.
Auth.AuthToken.getAccessTokenMap(auId, 'Open ID Connect');
then
Auth.AuthToken.refreshAccessToken(auId, 'Open ID Connect', authToken);
with authToken being actually the access_token.
The last line of code is returning
invalid_grant unknown, invalid, or expired refresh token
but only if authToken has expired, if it's still within it's lifespan the refresh actually works.
The thing is I don't know when the user will need a token(mostly used to call an external system) so I can't make something like "ok lets refresh a few minutes before the actual token gonna expire".
Also I can't understand why the standard class Auth.AuthToken can't/don't return an actual refresh_token value but just an access_token actually.
Anyone? Thank you