Hi,
I'm getting users to link their Betfair account with our web app, but I seem to be getting INVALID_AUTH_CODE, despite the code looking as expected.
I log the code right before posting it back to the /token endpoint, along with the grant_type, etc, but just get this back. It seem fine yesterday, with the mobile app, but not today with the web app. Both using same node.js API.
Has anyone had the same issue or know what it could be? Do I have to encode the auth code or anything?
Thanks.
I'm in a MongoDB function here, so some syntax is a little different. All working as expected, just the authorisation code not working.
I'm getting users to link their Betfair account with our web app, but I seem to be getting INVALID_AUTH_CODE, despite the code looking as expected.
I log the code right before posting it back to the /token endpoint, along with the grant_type, etc, but just get this back. It seem fine yesterday, with the mobile app, but not today with the web app. Both using same node.js API.
Has anyone had the same issue or know what it could be? Do I have to encode the auth code or anything?
Thanks.
Code:
const http = context.services.get("http");
return http.post({
headers: {
"X-Application": [<APPID>],
"X-Authentication": [token],
"Content-Type": ["application/json"],
"Accept": ["application/json"],
},
url:'https://api.betfair.com/exchange/account/json-rpc/v1',
body: '{"jsonrpc": "2.0", "method": "AccountAPING/v1.0/token", "params": {"client_id":"' + client_id + '","grant_type":"AUTHORIZATION_CODE","code": "' + code + '","client_secret": "' + client_secret + '"}, "id": 1 }'
})
.then(result => {
const ejson_body = EJSON.parse(result.body.text());
return ejson_body;
});


Comment