The old Chilkat forum appears to have moved here.
For years I've had Chilkat's OAuth1 working fine for integration with Xero (from Xojo). Now Xero are replacing OAuth1 with OAuth2. Xero say that once you successfully connect with 3-legged OAuth2, you can use the refresh token to keep reconnecting, without having to go through the 3-legged process (i.e. user agreement to allow your connection) each time. So once you have done the 3-legged once, you don't need to do it again: each unused Refresh token remains valid for 60 days (but can be used only once). So the process appears to be:
- 3-Legged connection, approve manually, retrieve Access and Refresh Tokens
- Use Refresh token, getting the required data plus a new Refresh token, without manual approval being needed.
- Repeat (2) forever, only needing to do (1) again if something goes wrong.
The Chilkat OAuth2 Xojo plugin help shows how to do (1). However I've no idea how to do (2). I'm far from expert in using REST (if I was, I wouldn't be using Chilkat ;-) ) so Xojo code preferred, but even pseudo-code would help!
Thanks
Thanks for the comments. I have now got this working so am posting my answer for anyone who has the same problems.
After linked your oauth2-using App in Xero Developer, the first step in oauth2 is the "3-legged" step where you have to have user approval. I have been unable to get the Chilkat example to work (redirect not allowed). However as you generally only need to do this once, it is easy enough to just use the xoauth Terminal script Xero provide. Basically you just:
Once you've done that, you can use the access_token in your App, refreshing it as required with the refresh_token (which is changed each time you do that).
Here's how, using the Chilkat plug-ins:
The rest object is now ready to use for interfacing with Xero. E.g. to get some data: