Hi,
I found the documentation on Basic Authentication.
documentation.progress.com/.../index.html
But I am not sure how to implement the following using the HttpClient.
Any ideas where to start? Thanks.
clientid=myid
clientsecret=mysecret
username=myusername
password=mypassword
scope=myscope
auth64=`echo -n $clientid:$clientsecret|base64 --wrap=0`
curl "$url/oauth/token" \
-H "Accept: application/json" \
-H "Authorization: Basic $auth64" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data "grant_type=password&username=$username&password=$password&scope=$scope" \
--compressed
Any idea why my posts are always in one big line? This happens to me on Chrome, Edge, ... on Windows 10.
Never mind I have added some html paragraph code ... not very friendly...
Simon,
I've added some examples/samples at github.com/.../http_authentication .
Thanks, but I'm still not sure how to handle the $auth64 (see example) in combination with username/password?
Right! I will give it a try. Thanks.
Using basic_preemptive.p.
What domain should I use? If I leave it empty I get the following error message: Domain cannot be empty.
I my case I only have a clientid (username?) and clientsecret (password?).
I am also not sure how to add the following curl parameter?
--data "grant_type=password&username=$username&password=$password&scope=$scope" \ -
Any ideas?
Edit: do I need to use WithData()?EDIT: NEVER MIND. IT SHOULD HAVE BEEN A POST INSTEAD OF A GET. PROBLEM SOLVED.
Thanks, any idea how to translate the curl --data param? Is the following code in the right direction?
Unfortunately I get the following error message:
HTTP status code: 400 { "errors": [ { "code": "2.5", "field": null, "description": "Request method not supported" } ] }
creds = new Credentials('abc', 'clientid', 'clientsecret').
oRequestBody = new String('grant_type=password&username=myuser&password=mypasswd&scope=myscope').
req = RequestBuilder:Get('partner.transfollow.com/.../', oRequestBody) // Add credentials to the request :UsingBasicAuthentication(creds) :ContentType('application/x-www-form-urlencoded') :AcceptJson() :Request.
resp = httpClient:Execute(req).
DEFINE VARIABLE oJsonEntity AS JsonObject NO-UNDO. DEFINE VARIABLE JsonString AS LONGCHAR NO-UNDO.
oJsonEntity = CAST(resp:Entity, JsonObject). oJsonEntity:Write(JsonString, TRUE).
Yes, I found out this morning that it should have been a POST. Thank you for your help.