I went through the docs as well as checked the available methods on the auth0 management object available in rules - there doesn’t seem to be a way to access the connection metadata in the rule.
What I’m trying to do:
We have multiple Salesforce Community connections (and our customers can create their own). In the JWT we need a claim stating which community this user logged in to (as the same Salesforce user can belong to multiple communities).
The simplest solution I’m trying to implement now is to add the community ID to the custom connection’s metadata, and in the rules we will fetch it from the connection metadat put it in the JWT claims.
Is there a way to access connection metadata in rules?
While it’s possible to use the management API with the access token provided by auth0.access_token as described here, it lacks the scope (read:connections) you need to read the connection metadata.
For this reason, you will need to request an access token via the client_credentials grant in the rule. You should create a specific non-interactive client for this and grant it only the read:connections scope.