basic access authentication

Post Reply
User avatar
Iris Gesser
Posts: 32
Joined: Fri Apr 22, 2016 10:19 pm

basic access authentication

Post by Iris Gesser »

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

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: 32
Joined: Fri Apr 22, 2016 10:19 pm

Re: basic access authentication

Post by Iris Gesser »

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
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: basic access authentication

Post by nageswaragunupudi »

Doesn't this work?

Code: Select all

loHyperlink:SetRequestHeader( "Authorization" ,"Basic " + hb_base64encode( "wusr90174-01:twertz34" ) )
Regards

G. N. Rao.
Hyderabad, India
User avatar
Iris Gesser
Posts: 32
Joined: Fri Apr 22, 2016 10:19 pm

Re: basic access authentication

Post by Iris Gesser »

Dear Mr. Rao,

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

Code: Select all

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: 32
Joined: Fri Apr 22, 2016 10:19 pm

Re: basic access authentication

Post by Iris Gesser »

Dear Mr. Rao,

it is resolved, thank you very much.

Code: Select all


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
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: basic access authentication

Post by nageswaragunupudi »

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

G. N. Rao.
Hyderabad, India
Post Reply