This is a Postman issue.
At time of writing, Postman isn't really a good choice for going through Salesforce's "JWT Bearer Flow" OAuth 2.0 flow.
- The "OAuth 2.0" Type helper (under the "Authorization" tab) doesn't have the appropriate Grant Type
- The "JWT Bearer" Type helper (under the "Authorization" tab) doesn't give us the option to add the JWT to the request body
Using the "JWT Bearer" Type helper can take care of most of the steps, but you would need to:
- add the
grant_type
, urn:ietf:params:oauth:grant-type:jwt-bearer
key/value pair as a body variable (x-www-form-urlencoded)
- go to the "code snippet" sidebar (
</>
in the right-hand sidebar), and copy the JWT (either from the Authorization header - everything after "Bearer ", or the "token" query parameter), then paste it into another body variable (the key would be "assertion")
An alternative to that second step would be to use a pre-request script in Postman to manually generate the JWT, and add it to the request body in a Pre-request script.
...at least it would be if we could encrypt using RSA (RS256 = RSA encryption followed by sending the ciphertext through SHA256). Postman only provides the aging (and no longer being developed) crypto-js
package, which does not have anything for using asymmetric encryption algorithms.