oAuth 2.0 Restful Web Service

oAuth 2.0 Restful Web Service

Postby byron.hopp » Wed Jun 16, 2021 9:27 pm

Is it possible to access a WebService using oAuth 2.0 from fivewin using CreateObject( "MSXML2.XmlHttp" ), I have been connecting with Carbonite using what seems to be a similar technique. I am attempting to access On-Site.com using their API's. There is some code to generate a Key and I believe this key is good for quite a while, whereas the Carbonite key needed to be generated every hour.

Sample code:
oHttp := CreateObject( "MSXML2.XmlHttp" )
hLogin["email" ] := "bhopp@matrixcomputer.com"
hLogin["password"] := "MyPassword"
cLogin := hb_JsonEncode( hLogin )

oHttp:Open( "POST","https:" + "/" + "/" + "api.carbonite.com:443/api/auth/login",.f. )
oHttp:SetRequestHeader( "Content-Type", "text/json" )
oHttp:Send( cLogin )

If oHttp:status == 200
cResponse := oHttp:ResponseText()
Logit( Mcs_AppPath() + "Request.txt",cResponse )
Else
MsgStop( "Status:" + oHttp:statusText,"Request Failed" )
Endif
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: oAuth 2.0 Restful Web Service

Postby Antonio Linares » Thu Jun 17, 2021 11:08 am

Dear Byron,

what result do you get ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42103
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: oAuth 2.0 Restful Web Service

Postby byron.hopp » Thu Jun 17, 2021 4:29 pm

Antonio,

This works Great, I guess I am going to try it, but I saw somebody posted using oAuth 2.0 and they utilized curl, which I am not familiar with, so I was hoping this would work. I have used this technique with Authorize.net as well. For each request the API describes what the result will look like.

I downloaded the oAuth specs and it's not a pretty read.

Thanks,

Byron ..
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests