Authentication trouble


#1

Hi,
I am trying to POST to https://api.freeagent.com/v2/token_endpoint the following and get 400 Bad Request:

grant_type=authorization_code&code=CODE&redirect_uri=REDIRECTURL

with “Authorization: Basic BASE64AUTHSTRING”.

I seem to be following instructions carefully - but are they up to date? Why am I getting 400?

Many thanks!


#2

Hi @urunotao ,

Ewa here from the Engineering Team at FreeAgent — thanks for your message on our forum and I’ll do my best to help out.

So that I can locate your requests in our logs, and hopefully spot the problem, could I ask that you provide some additional information from the list below?

The name of your app (as registered in Dev Dashboard)
Timestamps of your requests (in UTC)
The IP(s) from which your requests are being sent
Which environment are you querying? (production or sandbox)?

One thing to bear in mind is that the authorization code which you receive in the redirect URL after a user approves your app is only valid for 15 minutes, so it will have to be exchanged for an access and refresh tokens within that timeframe. Other than that, as long as you pass the redirect_uri which you registered on Dev Dashboard, correct code and grant_type=authorization_code in your request body, and your client ID and secret in the Authorization header, things should work as expected; you can test this process using our Quick Start Guide and the Google OAuth 2.0 Playground.

Best wishes,

Ewa


#3

Hi Ewa, thank you very much for getting back to me :slight_smile:

X-Request-Id: f930f0b7db0970cf57cb0b35df418988
Date: Sun, 24 May 2020 20:23:31 GMT
X-Rev: 65603f7912abfce15336b44bfbeda839f596b0c9
Env: prod

Can I PM you the app details/IP?

Many thanks! :pray:


#4

Hi @urunotao,

I’ve just sent you a private message :slight_smile:

Best wishes,

Ewa