FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour oAuth 2.0 Restful Web Service
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
oAuth 2.0 Restful Web Service
Posted: Wed Jun 16, 2021 09: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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: oAuth 2.0 Restful Web Service
Posted: Thu Jun 17, 2021 11:08 AM

Dear Byron,

what result do you get ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: oAuth 2.0 Restful Web Service
Posted: Thu Jun 17, 2021 04: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

Continue the discussion