basic access authentication

basic access authentication

Postby Iris Gesser » Tue Jul 28, 2020 10:56 pm

Dear community,

I am not familiar with basic access authentication.
Ist there a way to post an XML with basic access authentication?
I have tried this code, but I think it is just nonsense....
Code: Select all  Expand view  RUN

loHyperlink := CreateObject( 'Microsoft.XMLHTTP' )

cHttpSend := [{ "user": ]+hb_base64Encode(alltrim(cHotelCode)+":")+[, "password": ]+hb_base64Encode(alltrim( cMsgPassword ))+[}]

loHyperlink:Open( "POST" ,cUrl, .F. )
loHyperlink:SetRequestHeader( "Accept" , "application/json" )
loHyperlink:SetRequestHeader( "Content-Type" , "application/json" )

loHyperlink:SetRequestHeader( "Authorization" , cHttpSend )
loHyperlink:Send( cXML )


I am thankfull for your help.
Kind regards
Iris
User avatar
Iris Gesser
 
Posts: 37
Joined: Fri Apr 22, 2016 10:19 pm

Re: basic access authentication

Postby Iris Gesser » Tue Jul 28, 2020 11:08 pm

This are the credentials, that I have to use:

https://www.korrespondenzmanager.com/be ... /index.php
Benutzer: wusr90174-01
Passwort: twertz34

Thank you for your help
Iris
User avatar
Iris Gesser
 
Posts: 37
Joined: Fri Apr 22, 2016 10:19 pm

Re: basic access authentication

Postby nageswaragunupudi » Wed Jul 29, 2020 4:18 am

Doesn't this work?
Code: Select all  Expand view  RUN
loHyperlink:SetRequestHeader( "Authorization" ,"Basic " + hb_base64encode( "wusr90174-01:twertz34" ) )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10650
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: basic access authentication

Postby Iris Gesser » Wed Jul 29, 2020 7:32 am

Dear Mr. Rao,

unfortunately it does not work, but I do not find the error.
I have changed it like this:

Code: Select all  Expand view  RUN

loHyperlink := CreateObject( 'Microsoft.XMLHTTP' )
loHyperlink:Open( "POST" ,"https://www.korrespondenzmanager.com/betriebe/2710335266647221/index.php", .F. )
loHyperlink:SetRequestHeader( "Authorization" ,"Basic " + hb_base64encode( "wusr90174-01:twertz34" ) )
loHyperlink:Send( cXML )


This is the reponsetext:
[img]c:\xmm_terminal\LOGO\Clip1.jpg[/img]

Kind regards
Iris
User avatar
Iris Gesser
 
Posts: 37
Joined: Fri Apr 22, 2016 10:19 pm

Re: basic access authentication

Postby Iris Gesser » Wed Jul 29, 2020 8:01 am

Dear Mr. Rao,

it is resolved, thank you very much.
Code: Select all  Expand view  RUN


cUserPW := hb_base64encode(cHotelCode+":"+cMsgPassword,len(cHotelCode+":"+cMsgPassword))

set date french
set century on


loHyperlink := CreateObject( 'Microsoft.XMLHTTP' )


loHyperlink:Open( "POST" ,"https://www.korrespondenzmanager.com/betriebe/2710335266647221/index.php", .F. )
loHyperlink:SetRequestHeader( "Authorization" ,"Basic " + cUserPW )


loHyperlink:Send( cXML )


Kind regards
Iris
User avatar
Iris Gesser
 
Posts: 37
Joined: Fri Apr 22, 2016 10:19 pm

Re: basic access authentication

Postby nageswaragunupudi » Wed Jul 29, 2020 3:21 pm

Yes, hb_base64encode() requires length of the string as the second parameter. Sorry I omitted that by mistake.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10650
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 56 guests