401 When Refreshing Token

Hey,

Im successfully pulling back data from the FreeAgent API
(Recurring invoices etc) - However, the app has to automatically update
it’s token (It’s a Reporting service). When ever I post data (Details
below) I get a 401 Unauth. I know the token works as I can get data, it’s
only happening when I post the refresh token.

Any suggestion on how I can dig into this more?

Headers

POST /v2/token_endpoint HTTP/1.1
Authorization: Bearer {TOKEN}
User-Agent: SilverChip Systems Reporting App
Content-Type: application/x-www-form-urlencoded
Host: api.freeagent.com
Content-Length: 80
Expect: 100-continue
Connection: Keep-Alive

Data

grant_type=refresh_token&refresh_token={REFRESH TOKEN}

Response

HTTP/1.1 401 Unauthorized

Server: nginx/1.0.14

Content-Type: text/html; charset=utf-8

Connection: keep-alive

Status: 401 Unauthorized

WWW-Authenticate: Basic realm=“Application”

Cache-Control: no-cache

X-UA-Compatible: IE=Edge,chrome=1

X-Runtime: 0.137981

X-Rev: 8e43540

X-Host: web3

Content-Length: 27

HTTP Basic: Access denied.

Hi Liam,

I’m glad to hear you managed to figure it out. If you run in to any more
problems our documentation site is at FreeAgent Developer Dashboard in
case you haven’t found it yet and if that doesn’t answer your question
please do get in touch.

Regards,
Harry MillsOn Mon, Jan 28, 2013 at 2:27 PM, liam@liambateman.net wrote:

Hey,

Im successfully pulling back data from the FreeAgent API
(Recurring invoices etc) - However, the app has to automatically update
it’s token (It’s a Reporting service). When ever I post data (Details
below) I get a 401 Unauth. I know the token works as I can get data, it’s
only happening when I post the refresh token.

Any suggestion on how I can dig into this more?

Headers

POST /v2/token_endpoint HTTP/1.1
Authorization: Bearer {TOKEN}
User-Agent: SilverChip Systems Reporting App
Content-Type: application/x-www-form-urlencoded
Host: api.freeagent.com
Content-Length: 80
Expect: 100-continue
Connection: Keep-Alive

Data
*
*

grant_type=refresh_token&refresh_token={REFRESH TOKEN}

Response

HTTP/1.1 401 Unauthorized

Server: nginx/1.0.14

Date: Mon, 28 Jan 2013 14:23:06 GMT

Content-Type: text/html; charset=utf-8

Connection: keep-alive

Status: 401 Unauthorized

WWW-Authenticate: Basic realm=“Application”

Cache-Control: no-cache

X-UA-Compatible: IE=Edge,chrome=1

X-Runtime: 0.137981

X-Rev: 8e43540

X-Host: web3

Content-Length: 27

HTTP Basic: Access denied.


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.
Visit this group at http://groups.google.com/group/freeagent_api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Looks like I need to send, App Secret and ID over as well. Seems to be ok
now, there are a few posts on this forum that dont mention that and I was
using that as a guide. Google’s Playground pointed me in the right
direction!

CheersOn Monday, January 28, 2013 2:27:31 PM UTC, li...@liambateman.net wrote:

Hey,

Im successfully pulling back data from the FreeAgent API
(Recurring invoices etc) - However, the app has to automatically update
it’s token (It’s a Reporting service). When ever I post data (Details
below) I get a 401 Unauth. I know the token works as I can get data, it’s
only happening when I post the refresh token.

Any suggestion on how I can dig into this more?

Headers

POST /v2/token_endpoint HTTP/1.1
Authorization: Bearer {TOKEN}
User-Agent: SilverChip Systems Reporting App
Content-Type: application/x-www-form-urlencoded
Host: api.freeagent.com
Content-Length: 80
Expect: 100-continue
Connection: Keep-Alive

Data
*
*

grant_type=refresh_token&refresh_token={REFRESH TOKEN}

Response

HTTP/1.1 401 Unauthorized

Server: nginx/1.0.14

Date: Mon, 28 Jan 2013 14:23:06 GMT

Content-Type: text/html; charset=utf-8

Connection: keep-alive

Status: 401 Unauthorized

WWW-Authenticate: Basic realm=“Application”

Cache-Control: no-cache

X-UA-Compatible: IE=Edge,chrome=1

X-Runtime: 0.137981

X-Rev: 8e43540

X-Host: web3

Content-Length: 27

HTTP Basic: Access denied.