Maybe someone here can help me … I’m trying to get an oauth token from C8 via a C program I’m writing, and for the life of me I can’t! Here’s the JSON I send:
{
"client_id": "not-my-real-id",
"client_secret": "obfuscated-for-obvious-reasons",
"audience": "zeebe.camunda.io",
"grant_type": "client_credentials"
}
The response I get is:
400 Mandatory parameters missing: client_id client_secret audience
Which is odd since they are right there in the JSON! I can run the exact same JSON to the exact same endpoint https://login.cloud.camunda.io from Postman and get back the token.
If I println()
the payload before sending it, I see:
{"client_id":"1D_yXoNJ_4-oWNMzzjMsk6kQd--PH7.g","client_secret":"obfuscated-for-obvious-reasons","audience":"zeebe.camunda.io","grant_type":"client_credentials"}
Which is just the previous json without pretty-printing. I set the Content-Type: application/json
header as well.
Any help would be greatly appreciated!
TIA,
dg
jwulf
April 2, 2022, 1:48am
2
How I would debug this - spin up a http server like simple http, and check what your code is actually posting…
Looks like it’s a bug in the Camunda Cloud OAuth server then.
I spun up a quick https server (Golang) and here’s what I got from my http client (test)
ser-Agent Paw/3.3.6 (Macintosh; OS X/12.3.0) GCDHTTPRequest
Content-Length 195
Accept application/json
Content-Type application/json
{ClientID:CORRECT-CLIENT-ID ClientSecret:CORRECT-CLIENT-SECRET GrantType:client_credentials Audience:zeebe.camunda.io}
So I tried it from the C-Client:
User-Agent ESP8266HTTPClient
Accept-Encoding identity;q=1,chunked;q=0.1,*;q=0
Connection close
Content-Length 195
{ClientID:CORRECT-CLIENT-ID ClientSecret:CORRECT-CLIENT-SECRET GrantType:client_credentials Audience:zeebe.camunda.io}
And the C-Client says:
Getting C8 Authorization ...
Overflowed: 0
Json Doc: {"client_id":"OBFUSCATED-OBVS","client_secret":"OBFUSCATER-OBVS,"audience":"zeebe.camunda.io","grant_type":"client_credentials"}
Posting ...
[HTTP] POST...
[HTTP] POST... code: 200
received payload:
<<
Hello, %!s(<nil>)!
>>
(that Hello ...
is just the foo that my 2-minute server sends back)
So, the exact same thing. But when I try from the C-Client to the actual OAuth server, I get back:
Getting C8 Authorization ...
Overflowed: 0
Json Doc: {"client_id":"OBFUSCATED-OBVS","client_secret":"OBFUSCATED-OBVS","audience":"zeebe.camunda.io","grant_type":"client_credentials"}
Posting ...
[HTTP] POST...
[HTTP] POST... code: 400
received payload:
<<
Mandatory parameters missing: client_id client_secret audience
>>
I think I’ll go file a bug. :-