I am new to Postman. I hope this is what you’re looking for. Code Snippet and select HTTP. From Postman….
GET /535b2d87-664f-415a-b7fa-fd3f1086d450/oauth2/token HTTP/1.1
Host:
login.microsoftonline.com
Authorization: Bearer null
Cookie: fpc=AmlHew07s8NFsD-l8jtX0Ief_YrjAQAAANvp2tcOAAAA; stsservicecookie=ests; x-ms-gateway-slice=prod
Content-Length: 398
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="client_id"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="client_secret"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="grant_type"
client_credentials
----WebKitFormBoundary7MA4YWxkTrZu0gW
My code:
URL = ''
+ '?grant_type=client_credentials'
+ '&client_id=' + %TRIM(ClientID)
+ '&client_secret=' + %Trim(ClientSecret);
http_xproc( http_point_addl_header: %paddr(AddHeader));
rc = http_req('GET'
: URL
: '/tmp/httpauth.json');
*inlr = *on;
P AddHeader B
D PI
D Header 32767a varying
D CRLF C x'0d25'
Header = 'Authorization: Bearer null' + CRLF;
P E
Httplog
http_long_ParseURL(): entered
do_oper(GET): entered
There are 0 cookies in the cache
GET /535b2d87-664f-415a-b7fa-fd3f1086d450/oauth2/token?grant_type=client_credentials&client_id=XXXXXXXXXXXXXXXXXXXXXXX&client_secret=XXXXXXXXXXXXXXXXXXXXXXXXXX HTTP/1.1
Host:
login.microsoftonline.com
User-Agent: http-api/1.43
Authorization: Bearer null
recvresp(): entered
HTTP/1.1 200 OK
Cache-Control: no-store, no-cache
Pragma: no-cache
Content-Length: 150398
Content-Type: text/html; charset=utf-8
In the stmf that comes back, it states the end point is used for POST, OPTIONS. I asked the support staff from Altria about this and the response was “Please make sure the client_id,client_secret&grant_type
are sent in the ‘body’ of the call rather than ‘parameters’.”
|
[CAUTION] This email originated from outside Core-Mark. Do not click links or open attachments unless you recognize
the sender and know the content is safe.
|
Well, if you have Postman working, post the raw HTTP request from postman, and if HTTPAPI can do a debug to show the exact request made, post that as well
and maybe we can tell where the difference is.
Vendor is Altria. They are using the Microsoft site to issue the authorization token. I would guess that 535b2d87-664f-415a-b7fa-fd3f1086d450 is used for all of their customers
to get the token from Microsoft. Once I have the token, I go to another endpoint to get the actual data. This part I’m able to get to work. I just copy and paste the token that I get from Postman into a data area.
|
[CAUTION] This email originated from outside Core-Mark. Do not click links or open attachments unless you recognize
the sender and know the content is safe.
|
Is the vendor Microsoft?
Is that your tenant ID (or possibly an example?)
535b2d87-664f-415a-b7fa-fd3f1086d450
The documentation (attached) is from the vendor.
|
[CAUTION] This email originated from outside Core-Mark. Do not click links or open attachments unless you recognize
the sender and know the content is safe.
|
Is that your tenant ID?
535b2d87-664f-415a-b7fa-fd3f1086d450
Is that documentation from Microsoft or someone else? Provide a link if possible.
This is from the vendor’s documentation…

|
[CAUTION] This email originated from outside Core-Mark. Do not click links or open attachments unless you recognize
the sender and know the content is safe.
|
If that was provided by microsoft then you'll want to ask them why your request isn't working. Also, we see a cookie and Authorization header in
their example as well.
Where exactly did you get that example? And is that your tenant ID (535b2d87-664f-415a-b7fa-fd3f1086d450)?
curl --location --request GET 'https://login.microsoftonline.com/535b2d87-664f-415a-b7fa-fd3f1086d450/oauth2/token' \
--header 'Authorization: Bearer null' \
--header 'Cookie: fpc=AsRmKCSoZd5MoZkTHpKLW42f_YrjAQAAALHJ2tcOAAAA' \
--form 'client_id="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"' \
--form 'client_secret="XXXXXXXXXXXXXXXXXXXXXXXXXXx"' \
--form 'grant_type="client_credentials"'
|
[CAUTION] This email originated from outside Core-Mark. Do not click links or open attachments unless you recognize
the sender and know the content is safe.
|
A GET doesn't have data in the body of the request, a POST does.
Ask them if they can provide a cURL example that works... or a Postman example.
I have very little experience with HTML and have followed the examples and suggestions in the forum. However, I am still having some issues. The support staff with the endpoint
assure me that this should be a GET.
I am trying to get an authentication token, passing Client ID and Client Secret.
Here is my code:
URL = '';
FormData = 'grant_type=client_credentials'
+ '&client_id=' + %TRIM(ClientID)
+ '&client_secret=' + %Trim(ClientSecret);
http_xproc( http_point_addl_header: %paddr(AddHeader1));
rc = http_req('GET'
: URL
: '/tmp/httpauth.json'
: *Omit
: *Omit
: FormData);
I have also tried:
URL = ''
+ '?grant_type=client_credentials'
+ '&client_id=' + %TRIM(ClientID)
+ '&client_secret=' + %Trim(ClientSecret);
http_xproc( http_point_addl_header: %paddr(AddHeader1));
rc = http_req('GET'
: URL
: '/tmp/httpauth.json');
They have told me that “grant_type”, “client_id”, and “client_secret” need to be in the body of the request. At this point, I am stumped. Any help is greatly appreciated.
Corby Weaver - Core-Mark Midcontinent, Inc.
Iowa Division IT
corby.weaver@xxxxxxxxxxxxx
--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi
--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi
--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi
--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi
--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi