Skip to main content

In the case of a custom AuthProviderPlugin, does the "{!$Credential.OAuthToken}" contain the OAuth2 access token for a Bearer Token auth ?

Documentation only mentions :

// The external system expects “OAuth” as the prefix for the access token.

req.setHeader('Authorization', 'OAuth {!$Credential.OAuthToken}');

 

What is the correct way of generating a custom header for a Bearer authorization header with the credential's token ?

4 comentarios
  1. 21 jun 2021, 12:50

    OK @Samuel Rosen, let's start over :

    The documentation says :

    // The external system expects “OAuth” as the prefix for the access token.

    req.setHeader('Authorization', 'OAuth {!$Credential.OAuthToken}');

     

    So my question is : does this work ?

    req.setHeader('Authorization', 'Bearer {!$Credential.OAuthToken}');

     

    Simple, I think.  The way the doc. is written implies that 'Bearer' is not an option.

    So this makes the experienced dev worry and questions himself : is the doc imprecise, or does in *really* not accept 'Bearer' ?

0/9000