I'm trying (and failing) to set up a connection between 2 Salesforce orgs.
This AITechone video How to configure Named credentials in salesforce to connect 2 Salesforce Org ? explains how to use a Named Credential and Auth Provider on the calling side and a Connected App on the called side. The Auth Provider holds a copy of the Consumer Key and Consumer Secret.
But as this approach is designated "Legacy", I would prefer to use the new External Credential mechanism (see Named Credentials and External Credentials) instead and side-step the Auth Provider part by using the "JWT Bearer Flow" and a Signing Certificate. But still failing after several hours with these log lines:
09:56:30.0 (8568705)|CALLOUT_REQUEST|[85]|System.HttpRequest[Endpoint=callout:MyNamedCredential/services/data/v56.0/..., Method=GET] 09:56:30.76 09:56:30.76 (76404970)|NAMED_CREDENTIAL_RESPONSE|NamedCallout[Named Credential Id=null, Named Credential Name=null, Status Code=0, Content-Type=null, Response Size bytes=0, Overall Callout Time ms=0, Connect Time ms=0 ... 09:56:30.0 (77389457)|FATAL_ERROR|System.CalloutException: Unable to complete the JWT token exchange. that conclude with this that gives little away:
Unable to complete the JWT token exchange.
If you know of a step by step recipe, or that this can't be made to work at the moment, please share.


