Hi Cheesa
This looks like you might be using my FreeAgent client for .NET?
If so, there is sample code in the test project:
You will need to add a file into there called “KeyStorage.cs” which
has the keys in used for testing (you can get these either by running
the tests and getting the values out, or use the google sandbox
thing). I dont include it because it has MY keys in there.
To get the AppKey/AppSecret, you go to https://dev.freeagent.com/ and
make an app - both of them are in there.
Then, you get the refresh token when you first connect:
and with that, you can get a new AccessToken for each session (they
last 86400 seconds, so I suggest you get one, do your work, then throw
it away and get a new one for the next “run”)
The callbackUri that you have there is NOT your freeagent app, it’s
the app you are trying to connect. So lets say you are writing
CheesaTimeTracker.com, your user starts on
http://cheesatimetracker.com/login
they hit a button to connect to freeagent, which takes them to
http://api.freeagent.com/whatever, they login etc. On the last screen
of the freeagent but, they are then redirected to
http://cheesatimetracker.com/something
this url (/something) needs to capture the various oauth tokens (which
are get parameters, eg /something?code=big-long-hex-number)
Or you can use the API:
//pass in the full URL, it’ll find the code=<> bit…
string code = client.ExtractCodeFromUrl(url);
var newToken = client.GetAccessToken (code, callbackUri);
the newToken is where you find the RefreshToken and AccessToken
KeyStorage.cs:
using System;
namespace ConsoleRunner
{
public partial class MainClass
{
public static string AppKey = “This comes from the freeagent dashboard”;
public static string AppSecret = “So does this”;
public static string RefreshToken = "xxxxxx";
public static string SandboxAccessToken = "xxxxxx";
public static string BigTedAccessToken = "xxxxxx";
}
}On 15 July 2013 09:51, Jonathan Barrett jonathan@freeagent.com wrote:
Hi Cheesa,
Thanks for getting in touch, and sorry you’re having trouble here.
Can I ask if you’ve run through the “quick start” guide that Caius directed
you to? FreeAgent Developer Dashboard
Going through that step by step should help you get set up with creating an
app and ensuring it can be authorised against your sandbox account.
Cheers,
-J
On Monday, 15 July 2013 06:59:01 UTC+1, Cheesa wrote:
On Friday, July 12, 2013 4:28:00 PM UTC+5, Caius Durling wrote:
Hi Cheesa,
You’ve registered a production account and then tried to login to the
sandbox with those credentials, which is why it will be failing to log you
in. (The sandbox exists to allow people to play around with the API without
having to use a production freeagent account.) You will either need to go to
Sign up for your free 30-day trial of FreeAgent and create a sandbox account,
then use that to login as you’ve already tried. Or use the production API
endpoints, by changing api.sandbox.freeagent.com to api.freeagent.com in the
approve_app URL you’re using, and then sign in with the exgexport
credentials you’ve already created.
I also suggest reading our quick start document if you’ve not come across
it already, FreeAgent Developer Dashboard 
Hope that helps!
Caius
–
You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to freeagent_api+unsubscribe@googlegroups.com.
To post to this group, send email to freeagent_api@googlegroups.com.
Visit this group at http://groups.google.com/group/freeagent_api.
For more options, visit https://groups.google.com/groups/opt_out.
Nic Wise
t. +44 7788 592 806 | @fastchicken
b. http://www.fastchicken.co.nz/