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

Re: [Ftpapi] Authorization Token Request Assistance



Hi,

In addition to Scots suggestion, can I also suggest you use http_debug

You can then see details details of what you are creating by looking in the IFS at the output. 

You can then compare this to the raw view in Postman, it becomes very obvious what you are doing wrong. 

Regards,

John

Development Manager

On 9 Feb 2021, at 23:13, Weaver, Corby <corby.weaver@xxxxxxxxxxxxx> wrote:


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
https://protect-eu.mimecast.com/s/a3puCZ8EZIR6gRujjwFr?domain=scottklement.com

 
The information contained in this communication from john.long@xxxxxxxxxxxxxx sent at 2021-02-10 07:32:49 is confidential and may be legally privileged or protected by other legal rules. This e-mail (and any attachments) is intended solely for use by ftpapi@xxxxxxxxxxxxxxxxxxxxxx and may contain personal views which are not the views of the TJ Morris Ltd unless specifically stated. If you are not ftpapi@xxxxxxxxxxxxxxxxxxxxxx, please contact the sender by reply e-mail and destroy all copies of the original message. You should not copy it or disclose its contents to any other person.
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi