There are a few different types of token-exchange available in Keycloak. The type needed for exchanging an external Apple token for a Keycloak token is external token to keycloak token.
In order for token-exchange to work you need to enable token-exchange and admin-fine-grained-authz preview features in Keycloak (see this Dockerfile or here).
After enabling the features from above you need to grant the Apple identity provider the permission to exchange tokens.
- Enable permissions on your client
- Create a token-exchange permission on your client
-
Hit save and click into the Policies field to create a new policy.
-
Create a policy for your client
- Navigate to the Apple Identity Provider and enable permissions
- Create a token-exchange permission on the Apple Identity Provider
References