Quick start using the Google OAuth 2.0 Playground.

The Google OAuth 2.0 Playground enables developers to explore OAuth 2.0 compatible APIs without writing code.

To use the FreeAgent API with it do the following:

We'll link the OAuth Playground to this user account.

The OAuth identifier and secret will be needed for the OAuth Playground.

  • Follow these instructions to get an Access Token

The Access Token can be used with the OAuth Playground, Curl and your own apps during development.

To use the production API change the server in the examples below to: api.freeagent.com

Setup Instructions

Go to the Google OAuth 2.0 Playground

The URL above sets up the Playground with FreeAgent's OAuth Authorization Endpoint:

https://api.sandbox.freeagent.com/v2/approve_app

and the OAuth Token Endpoint:

https://api.sandbox.freeagent.com/v2/token_endpoint

Click on the Cog icon and enter the OAuth Client ID and OAuth Client Secret for the App created above.

With the Link icon you can create a link to save these settings for future use and if you tick Include OAuth credentials and OAuth tokens in the link you won't have to enter the Client ID and Secret each time.

Enter some text in the Scope box. Google requires this to have a value but the FreeAgent API doesn't enforce its use.

Click Authorize APIs.

The Playground will redirect you to the Sandbox where you will have to log in to the FreeAgent Sandbox account you created earlier. After log in you can approve the Playground app.

Approving the app will return you to the Playground. Click Exchange Authorization Code for Tokens to create access and refresh tokens which can be used to access the API.

You can then access the FreeAgent API for the Sandbox account you authorised. For example try:

https://api.sandbox.freeagent.com/v2/company

which should produce:

{"company":{"type":"UkLimitedCompany","currency":"GBP","mileage_units":"miles","company_start_date":"2010-07-01","sales_tax_registration_status":"Registered"}}

Now that you have an Access Token, you can also use it with Curl or use it to test out your own app with the FreeAgent API before you implement OAuth authentication.

Next up, Introducing the FreeAgent API