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

[Ftpapi] Authorization Token Request Assistance



I have a process that needs to obtain an authorization token each time it is run. I've seen a few posts to this forum that are along the same line, but none seem to have a resolution. One says you do not need to do a GET, but only do a SETAUTH. Not seeing a whole lot with that. 

The documentation from the vendor has this example for the token request:
GET /535b2d87-664f-415a-b7fa-fd3f1086d450/oauth2/token HTTP/1.1 
Host: login.microsoftonline.com Content-Type: application/x-www-form-urlencoded 
Cache-Control: no-cache
 
grant_type=client_credentials&client_id=XXXXXXXXXX&client_secret=XXXXXXXXXXX


Here is my chunk of code...

URL = '';    
                                                               
Request =                                                      
'HTTP/1.1 Host: login.microsoftonline.com +                    
    Content-Type: application/x-www-form-urlencoded +          
    Cache-Control: no-cache +                                  
    grant_type=client_credentials+                            
    &client_id:' + %TRIM(ClientID) +                          
    '&client_secret:' +                                        
    %Trim(ClientSecret);                                      
                                                               
response = http_string( 'GET': URL: Request);                  
                                                               
In my httplog, I get an error that says the request body must contain "grant_type".

I'm able to successfully obtain my token using Postman. I'm guessing there's a syntax thing going on or I'm just missing something.

Any help would be appreciated

Corby Weaver

Core-Mark Midcontinent, Inc.  DBA Farner-Bocken Company

Email: corby.weaver@xxxxxxxxxxxxx

 

3D1E3150


-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi