Solved

API Authorization Request: Can I send credentials in body vs headers?

  • 28 March 2024
  • 2 replies
  • 28 views

Badge +1

I’m trying to set up a REST service broker to integrate with USPS’ address validation API.  In order to get the token, this is the code example USPS provides: 

curl -X 'POST' "https://api.usps.com/oauth2/v3/token" \     --header 'Content-Type: application/json' \     --data '{		"client_id": "$CLIENT_ID",		"client_secret": "$CLIENT_SECRET",		"grant_type": "client_credentials"		}'When I added these values as Resource Parameters and attempt to set up the service instance, I’m redirected for validation and receive the following error:
{"fault":{"faultstring":"Raising fault. Fault name : Raise-Fault-Request-Body-Missing","detail":{"errorcode":"steps.raisefault.RaiseFault"}}}When I attempt this in Postman, I’m able to send the parameter values in the body and then I successfully retrieve a bearer token.  However, I’m not sure how to do that in K2 Cloud.  Is there a way that I can specify the resource parameters need to be sent in the body, vs header parameters? TYIA!
icon

Best answer by TinTex 28 March 2024, 21:30

View original

2 replies

Userlevel 3
Badge +10

Did you setup the client_credentials outbound flow similar to the following?

 

Badge +1

Ah, thank you.  I think I was missing the extension

Reply