Understanding CURL to Omnis example
Kelly Burgess
kellyb at montana.com
Fri Mar 10 04:48:43 UTC 2023
I misread bintobase64() - it returns a binary, not a character string. So that one line in my example needs correcting:
> Calculate authHeader as con('Basic ',bintobase64(authString))
should be
Calculate authHeader as con('Basic ',utf8tochar(bintobase64(authString)))
Kelly
> On Mar 9, 2023, at 9:36 PM, Kelly Burgess <kellyb at montana.com> wrote:
>
> Hi Das,
>
> According to this page - https://reqbin.com/req/c-2cd3jxee/curl-post-with-basic-authentication-example
>
> it says that CURL will base64-encode the user:password data and pass it in an Authorization header.
>
>> Curl automatically converts the provided login:password pair into a Base64-encoded string and adds an appropriate HTTP header to the request:
>>
>> "Authorization: Basic bG9naW46cGFzc3dvcmQ="
>
> So I suggest that you try that. Don't include any '-u' anywhere, because that's just the option switch used by CURL to tell it that a user:password follows.
>
> Calculate authString as con(userID,':',authToken)
> Calculate authHeader as con('Basic ',bintobase64(authString))
> Do headerList.$add('Authorization',authHeader)
>
> Kelly
More information about the omnisdev-en
mailing list