[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ftpapi] What am I missing?!?!



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)?



On Wed, Mar 10, 2021 at 9:56 AM Weaver, Corby <corby.weaver@xxxxxxxxxxxxx> wrote:

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"'

 

 

From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx <ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx> On Behalf Of Brad Stone
Sent: Wednesday, March 10, 2021 9:38 AM
To: FTPAPI/HTTPAPI mailing list <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [Ftpapi] What am I missing?!?!

 

 

  [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.

 

On Wed, Mar 10, 2021 at 9:32 AM Weaver, Corby <corby.weaver@xxxxxxxxxxxxx> wrote:

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 = "" href="https://urldefense.com/v3/__https:/login.microsoftonline.com/*__;Kw!!DjJsWdbdCQ!KJLg1nWUnU0iu_Q21FvpZc9hA77WNYvBT6bKOK0Q4P0cgndItv8YjnCVApx_9UOJ_JCccA$" target="_blank">https://login.microsoftonline.com/+                   

     535b2d87-664f-415a-b7fa-fd3f1086d450/oauth2/token';     

                                                              

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 = "" href="https://urldefense.com/v3/__https:/login.microsoftonline.com/*__;Kw!!DjJsWdbdCQ!KJLg1nWUnU0iu_Q21FvpZc9hA77WNYvBT6bKOK0Q4P0cgndItv8YjnCVApx_9UOJ_JCccA$" target="_blank">https://login.microsoftonline.com/+                    

     535b2d87-664f-415a-b7fa-fd3f1086d450/oauth2/token'       

     + '?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