curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: libcurl results in 403 when command-line curl works fine

From: Patrick Monnerat via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 14 Feb 2023 19:42:21 +0100

On 2/14/23 19:24, Bob Sorrells via curl-library wrote:
> Hello,
>
> I am working on a payment API that requires "Authentication: Bearer" authentication. My libcurl code to retrieve the bearer token is working fine. The token is passed to the header of an API call that submits a payment. The API is running on AWS. I am sending the request via a proxy server.
>
> I have a command-line version of the libcurl that is working just fine. However, my C implementation is reliably generating a 403 Forbidden.
>
> In my C implementation I have installed the "standard" debug.c machinery to match the "--trace-ascii" output from the curl executable. I have put the traces up side-by-side with the Beyond Compare tool and I see only one notable difference, which looks like the attached. I apologize for the image, but it was the only way I could include pertinent information while redacting sensitive material.

Your diff output only shows what is received, not the request: the
problem probably comes from what is in the request.

2 suggestions:

1) You post to this list the request contents diff (after having
obfuscated confidential data, of course): we need more information to
help you.

2) Use run your working curl command with additional argument --libcurl
<filename>: this will generate a file called <filename> containing a C
program skeleton corresponding to the submitted request. You can then
compare it to what you coded in your program.

Patrick

-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-02-14