Fetch Identity Provider token in protocol mapper


I have use case where I need to fetch extra information from an OIDC provider and add custom claims to the token keycloak generates.

I have wrote a custom Protocol Mapper and I’m stuck on how to fetch the IDP token (to do extra calls to the Idp) in the protocol mapper.

I know there is a keycloak API to read idp tokens but it needs to have the access token