Hi Marc
I just tweeted you 
You can do this easily for script if you would have otherwise stored a
username and password.
You can (manually!) throw out a auth URL. Paste it into a browser and
login as the user you want. This sends you back to the redirect URL
with code.
Swap this code for an access token and a refresh token. Throw away the
access token and keep the refresh one.
You only have to do this once (unless to disallow the app).
Now, in your script, just use the last part of the oauth flow, and get
a new access token:
… using the refresh token you got before. Then use the access token
to do all your calls, adding the header:
Authorization: Bearer
And you should be golden.
For example, I have unit tests for my .NET client, and I just store
the refresh token - and get a new access token in a run-once setup
method - then use it for all the tests. Run the tests again, get a new
access token.
HTH.
NicOn Tue, Jul 24, 2012 at 2:41 PM, Marc Palmer lists@anyware.co.uk wrote:
Hi,
Since the API change to OAuth and the old API is presumably killed (my script no longer works), how am I supposed to make my batch processing scripts work?
These are offline local-only scripts that migrate invoices from Harvest into FreeAgent, I just run them on an “as needed” basis.
I don’t currently see how I can do this without creating a web application just to serve the OAuth 2 requirements - designed for services to talk to each other, not for batch processes. This would be a nightmare for me.
Why can’t we have a generated API token for non-OAuth 2 access?
This has totally broken my workflow now. I now have to manually duplicate all my invoices in FreeAgent.
Marc
~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)
I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com
Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org | Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5
–
You received this message because you are subscribed to the Google Groups “FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/freeagent_api?hl=en.
Nic Wise
t. +44 7788 592 806 | @fastchicken | Nic Wise - Tend Health Ltd | LinkedIn
b. http://www.fastchicken.co.nz/
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2