So far, I added the line ns_set update $requestHeaders "Authorization" "Basic $auth_base64"
which is using set auth_base64 [base64::encode “********”] and the results are [15/Nov/2019:13:19:55][450.7f7a7d7fa700][task:tclhttp] Notice: HttpTaskRecv: connection probably closed by server (url https://api.sandbox.paypal.com/v1/oauth2/token) [15/Nov/2019:13:19:55][450.7f7a65ffb700][-conn:evex:88:31735-] Notice: status code 0 [15/Nov/2019:13:19:55][450.7f7a65ffb700][-conn:evex:88:31735-] Notice: reply [ > On Nov 15, 2019, at 12:21, Iuri Sampaio <i...@iurix.com> wrote: > > What would be the argument/switch to convert the option -u, from CURL > command, to ns_http command? > > curl -v https://myhost.com/oauth2/token <https://myhost.com/oauth2/token> \ > -H "Accept: application/json" \ > -H "Accept-Language: en_US" \ > -u "client_id:secret" \ > -d "grant_type=client_credentials" > > > > Reading ns_http documentation I was not able to figure that out. > https://naviserver.sourceforge.io/n/naviserver/files/ns_http.html#section3 > <https://naviserver.sourceforge.io/n/naviserver/files/ns_http.html#section3> > > > > set url "https://myhost.com/v1/oauth2/token > <https://myhost.com/v1/oauth2/token>" > set requestHeaders [ns_set create] > set replyHeaders [ns_set create] > > ns_set update $requestHeaders "Content-Type" "application/json" > ns_set update $requestHeaders "Accept" "application/json" > ns_set update $requestHeaders "Accept-Language" "en_US" > > set data "grant_type=client_credentials" > > > set result [ns_http queue -method POST \ > -headers $requestHeaders \ > -timeout 10.0 \ > -body $data \ > $url] > ns_http wait -result R -headers $replyHeaders -status S $result > > > > > Best wishes, > I > _______________________________________________ > naviserver-devel mailing list > naviserver-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/naviserver-devel
_______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel