hi there, i need to create a rest call like the example below:
POST /auth/realms/edoc/protocol/openid-connect/token
Authorization: Basic abcdefghilmnopqrstuvz
Content-Type: application/x-www-form-urlencoded
grant_type=password&username=mario&password=XJp45pzH
i'm not sure if it's possible and how to set an authorization header HTTP Basic as requested using a client_id and a client_secret that i own
Here is part of the code i'm using which is missing the auth basic header as requested
httpclient http
http = create httpclient
ls_URL = ls_token_uri + '/auth/realms/edoc/protocol/openid-connect/token'
ls_mime = 'application/x-www-form-urlencoded'
ls_parm = 'grant_type=password&username=' + ls_username + '&password=' + ls_password
ls_url = ls_url + '?' + ls_parm
http.SetRequestHeader("Content-Type", ls_mime)
li_ret = http.sendrequest( 'POST', ls_url, '')
if li_ret = 1 then
li_rc = http.GetResponseStatusCode()
if li_rc = 200 then http.GetResponseBody(ls_string)
...
any help would be appreciated
tia
and also how do you pass the parameters of the call in the body
to pass the parameters in the body:
ls_parm = ls_response_type + '&' + ls_user + '&' + ls_pass
bdata = blob(ls_parm, EncodingUTF8!)
li_ret = ln_http.sendrequest( 'POST', ls_url, bdata)
to encrypt any string in base64 you can look at this really useful Bcrypt object developed by Roland Smith
http://www.topwizprogramming.com/freecode_bcrypt.html