- Simone Olianti
- PowerBuilder
- Thursday, 7 June 2018 09:18 PM UTC
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
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.