LiveCode + Xero (OAuth1.0a)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
LiveCode + Xero (OAuth1.0a)
Hi All,
I am trying to integrate Xero (cloud-based accounting platform) with LiveCode and I'm not having fun.
Xero uses OAuth1.0a, I notice LiveCode has a library for OAuth2.0.
Has anyone done OAuth1.0a integration before? Help!
Thanks,
DK
I am trying to integrate Xero (cloud-based accounting platform) with LiveCode and I'm not having fun.
Xero uses OAuth1.0a, I notice LiveCode has a library for OAuth2.0.
Has anyone done OAuth1.0a integration before? Help!
Thanks,
DK
Re: LiveCode + Xero (OAuth1.0a)
G'Day Aphero,
No I haven't but I do have an appllication which logs into a site (mine) with https and uses public & private keys for encryption.
Doing a bit of quick reading about the difference between OAuth1.0 & 2.0 seems they are not compatible and the library will not be much help right now.
However, LiveCode already has https and encryption/decryption capabilities built in and they are easy to implement.
Logging into the site can be done with the Javascript handlers so that you can use the token provided by the Xero site for your authentication, much easier than trying to build a POST request from data stripped from the site and looks more like an end user to the site. I have a couple of posts here on how to do that if you need help.
Using Javascript you can maipulate cookies at any time on any page unlike PHP so you can get access to the session cookie if you need to, but you shouldn't need that if you are doing all your website stuff through the browser widget.
Moving your program data between your code and the browser widget is a bit tricky but not difficult, again I have posts here with the info you need.
Good Luck.
No I haven't but I do have an appllication which logs into a site (mine) with https and uses public & private keys for encryption.
Doing a bit of quick reading about the difference between OAuth1.0 & 2.0 seems they are not compatible and the library will not be much help right now.
However, LiveCode already has https and encryption/decryption capabilities built in and they are easy to implement.
Logging into the site can be done with the Javascript handlers so that you can use the token provided by the Xero site for your authentication, much easier than trying to build a POST request from data stripped from the site and looks more like an end user to the site. I have a couple of posts here on how to do that if you need help.
Using Javascript you can maipulate cookies at any time on any page unlike PHP so you can get access to the session cookie if you need to, but you shouldn't need that if you are doing all your website stuff through the browser widget.
Moving your program data between your code and the browser widget is a bit tricky but not difficult, again I have posts here with the info you need.
Good Luck.
Re: LiveCode + Xero (OAuth1.0a)
Just use put, post and get.
For example:
A Request token:
You get:
The Request Token provided above is already authorized, you may use it to request an Access Token right away.
You get
For example:
A Request token:
Code: Select all
put URL "http://term.ie/oauth/example/request_token.php?oauth_version=1.0&oauth_nonce=9b5e850e1d7d5662186274d01c44f828&oauth_timestamp=1501581721&oauth_consumer_key=key&oauth_signature_method=HMAC-SHA1&oauth_signature=mkgDlwnAie3ZtiIqmuiIzQu82qQ%3D"
Code: Select all
oauth_token=requestkey&oauth_token_secret=requestsecret
Code: Select all
put "oauth_signature=secret%2526requestsecret" after myData
put "&oauth_token=requestkey" after myData
put "&oauth_token_secret=requestsecret" after myData
put "&oauth_consumer_key=key" after myData
put "&oauth_timestamp=" & the seconds after myData
put "&oauth_signature_method=PLAINTEXT" after myData
post myData to URL "http://term.ie/oauth/example/access_token.php"
put it
Code: Select all
oauth_token=accesskey&oauth_token_secret=accesssecret
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: LiveCode + Xero (OAuth1.0a)
@MaxV
> Just use put, post and get.
This is what I am trying to achieve.
Xero uses Auth1.0a, and I think it is a one-legged approach, I'm using a private application, link below.
h_t_t_p_s://developer[.]xero[.]com/documentation/auth-and-limits/private-applications
Q1 - Where did you get the oauth_nonce from?
Q2 - Where did you get the oauth_signature from?
I have tried to use your code however it doesn't work for me, I have begun constructing the first put such as.
Any help is greatly appreciated.
Thanks,
DK
> Just use put, post and get.
This is what I am trying to achieve.
Xero uses Auth1.0a, and I think it is a one-legged approach, I'm using a private application, link below.
h_t_t_p_s://developer[.]xero[.]com/documentation/auth-and-limits/private-applications
Q1 - Where did you get the oauth_nonce from?
Q2 - Where did you get the oauth_signature from?
I have tried to use your code however it doesn't work for me, I have begun constructing the first put such as.
Code: Select all
on mouseUp
// Credentials are for a test account
put "WT9MWX8A3SOQTM5MY8I86ORDYORM22" into ConsumerKey
put "HSR8VU8ZUSAUZP8Y29F54NL4GIT2NV" into ConsumerSecret
put "h_t_t_p_s://api[.]xero[.]com/api.xro/2.0/" into URI_1
put "" into URI_2
put "" into URI_3
put URI_1 & URI_2 into PostURI
//Put
put URL PostURI
answer "Check"
end mouseUp
Thanks,
DK
Re: LiveCode + Xero (OAuth1.0a)
The last version of free livecode has the OAUTH2 libraries:
Can you use them?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: LiveCode + Xero (OAuth1.0a)
@ MaxV
No, Xero uses OAuth1.0a only, and I don't believe they are looking at changing anytime soon, I will raise it with them though.
Thanks,
DK
No, Xero uses OAuth1.0a only, and I don't believe they are looking at changing anytime soon, I will raise it with them though.
Thanks,
DK
-
- VIP Livecode Opensource Backer
- Posts: 118
- Joined: Thu Sep 20, 2012 5:11 pm
Re: LiveCode + Xero (OAuth1.0a)
Hello,
It has been 3 years since this thread had any activity.
I also have a vendor running OAuth1.0a, and the vendor has no intention of upgrading.
I have an API and some example code in JAVA. The vendor does not supply any other means of accessing their web site.
Is there any direct support in LiveCode for OAuth1.0a since there are vendors who don't believe that they need anything better than that?
Or do I need to figure out how to create and import a Java library and call it?
If so, is there a tutorial for doing this?
Thanks,
Andrew
It has been 3 years since this thread had any activity.
I also have a vendor running OAuth1.0a, and the vendor has no intention of upgrading.
I have an API and some example code in JAVA. The vendor does not supply any other means of accessing their web site.
Is there any direct support in LiveCode for OAuth1.0a since there are vendors who don't believe that they need anything better than that?
Or do I need to figure out how to create and import a Java library and call it?
If so, is there a tutorial for doing this?
Thanks,
Andrew
-
- Posts: 64
- Joined: Thu Jan 16, 2020 10:28 pm
- Location: Max Meadows, VA USA
Re: LiveCode + Xero (OAuth1.0a)
I’m curious, have you tried the solution noted above using the POST and GET functions?
-
- VIP Livecode Opensource Backer
- Posts: 118
- Joined: Thu Sep 20, 2012 5:11 pm
Re: LiveCode + Xero (OAuth1.0a)
Hello,
On another thread I found a post with a link to code to generate the HMACSHA1 oauthSignature from (can't find the link), anyway, from a while ago.
After I fixed a bunch bugs due to no local variables being declared, it works.
So that is the most difficult part of getting oauth1.0a going, since it involves lots of fancy hashing in a special way.
Next to find some oauth_nonce code somewhere.
Has anybody generated any code for that?
Once I stitch all the pieces together for oauth1.0a I will be asking how to put that stack into something publicly available to the rest of you.
On another thread I found a post with a link to code to generate the HMACSHA1 oauthSignature from (can't find the link), anyway, from a while ago.
After I fixed a bunch bugs due to no local variables being declared, it works.
So that is the most difficult part of getting oauth1.0a going, since it involves lots of fancy hashing in a special way.
Next to find some oauth_nonce code somewhere.
Has anybody generated any code for that?
Once I stitch all the pieces together for oauth1.0a I will be asking how to put that stack into something publicly available to the rest of you.
-
- VIP Livecode Opensource Backer
- Posts: 4016
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: LiveCode + Xero (OAuth1.0a)
the link seems to beaetaylorBUSBnWt wrote: ↑Wed Jul 29, 2020 2:30 am
On another thread I found a post with a link to code to generate the HMACSHA1 oauthSignature from (can't find the link), anyway, from a while ago.
viewtopic.php?f=11&t=22957&p=118539&hil ... A1#p118539
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 118
- Joined: Thu Sep 20, 2012 5:11 pm
Re: LiveCode + Xero (OAuth1.0a)
Excellent, thanks for that reference.
I added his name (Mark Smith) to the library code I downloaded and the web link - he had not given himself credit.
That wasn't the link I found the code from - that link took me to his web site that has several of his libraries available for download.
The link is: http://marksmith.on-rev.com/revstuff/
thanks,
Andrew
I added his name (Mark Smith) to the library code I downloaded and the web link - he had not given himself credit.
That wasn't the link I found the code from - that link took me to his web site that has several of his libraries available for download.
The link is: http://marksmith.on-rev.com/revstuff/
thanks,
Andrew
-
- VIP Livecode Opensource Backer
- Posts: 118
- Joined: Thu Sep 20, 2012 5:11 pm
Re: LiveCode + Xero (OAuth1.0a)
Hi,
I got nonce calculated, got the HMAC-SHA1 stuff working in Livecode.
Now - Java RestTemplate code is the stumbling block.
Is there a RestTemplate library for Livecode anywhere?
Thanks,
Andrew
I got nonce calculated, got the HMAC-SHA1 stuff working in Livecode.
Now - Java RestTemplate code is the stumbling block.
Is there a RestTemplate library for Livecode anywhere?
Thanks,
Andrew