1

My OpenApi 3.0 schema requires just a bearer token as authentication. Salesforce declarative Named Credential does not offer this as option. When using Password Authentication with a dummy username I understandably get a 404 Authentication Error.

Is there some kind of workaround using one of the supplied methods such as:

  • JWT
  • JWT Token Exchange
  • Oauth 2.0

that might be used as a workaround to avoid this error? The Salesforce PM responded in their portal stating an option for this is "on the roadmap"; however this is not helpful for today. The External Services Considerations state that

The standard HTTP request headers Accept, Content-Type, and Authorization are handled by the External Service and can't be overridden as OpenAPI operation input parameters. The Authorization header is set by the Named Credential.

Apex Named Credential would likely work; however this cannot be used with the declarative External Services which we are using in this case.

4
  • Where does your token come from?
    – identigral
    Jun 2 at 16:27
  • Is calling api without named creds an option (that you make a direct non-named creds api call and set the Auth header)?
    – metasync
    Jun 2 at 17:29
  • The provider of API just gives us the token, like a username. We can refresh it at will via their UI. Salesforce does not let us set the Auth header in the schema per their documentation (quoted above).
    – ddeve
    Jun 2 at 18:34
  • 1
    The API key style of token acquisition workflow doesn't fit NC/Ext Svcs. Your only option is to route the request through your own middleware (which could be a Function) that will act as a proxy and rewrite the headers to add the token.
    – identigral
    Jun 2 at 22:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.