0

Can we use Named credentials against 3rd party with following parameters requirements, which helps us to have access token:

  1. Endpoint
  2. Method - POST
  3. URL encoded body which has following
  4. Grant type = XXX
  5. client id
  6. client secret
  7. scope = XXX

If yes may I know specific ways/link to documentation. TIA.

1 Answer 1

2

Named Credential delegates its work to Authentication Provider component when oAuth is used as the protocol. Salesforce ships a number of Auth Providers or you can roll your own. The auth providers available out of the box wrap access APIs for specific platform such as LinkedIn or Facebook. The OpenID Connect (OIDC) auth provider is the most generic provider available.

Since OIDC is a protocol that is built on top of oAuth, you can provide the usual oAuth primitives as configuration items: client id, client secret, token endpoints, scope(s) and so on. Unfortunately the grant type for OIDC auth provider is fixed - it only supports authorization code grant type (this is undocumented). If you would like to be using other grant types, you need to develop your own auth provider.

3
  • AFAIK, creation of custom class also got some issues. In my case there is no authentication(like no dedicated id/password), it will directly goes for token generation. So how do you suggest I shall go for direct token generation(without any pre-authentication).
    – Ysr Shk
    Jan 17, 2020 at 6:29
  • 1
    Authorization of access by user via username/password or other means is not part of Auth.AuthProviderPluginClass interface. You have to obtain the tokens but how you do it is up to your implementation. See here for another example.
    – identigral
    Jan 19, 2020 at 17:16
  • Thank you, will check around that.
    – Ysr Shk
    Jan 20, 2020 at 4:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .