infusionsoft / infusionsoft-php

PHP client library for the Infusionsoft API.
https://developer.infusionsoft.com/
Other
129 stars 126 forks source link

Unable to exchange the code for a token #260

Closed aydin41k closed 4 years ago

aydin41k commented 4 years ago

I am following the exact code in the README file. However, I get stuck at this step:

$infusionsoft->requestAccessToken($_GET['code'])

Authorization is successful, and I can see a code returned. However, when a token is requested, I am getting this error:

HTTP/1.1 401 Unauthorized
Date: Wed, 29 Jul 2020 08:00:55 GMT
Content-Type: application/json
Content-Length: 155
Connection: keep-alive
            {
            "error": "invalid_grant",
            "error_description": "Unable to authenticate username and password"
            }

What is username and password? As per the documentation, to get the token I need to send _clientid (key), _clientsecret and the code returned after authorisation. I can see that those are being sent correctly. What is wrong with the request that the server is returning this error?

Thanks.

ajohnson6494 commented 4 years ago

Hello @aydin41k,

Can you double check that you are using the API Key for that app that you created at https://keys.developer.keap.com/, and not your App ID. I know that this has tricked a couple of people up.

aydin41k commented 4 years ago

Thanks for reply @ajohnson6494 ! Because I couldn't get anywhere with the SDK (this was 25 days ago), I wrote my own package to handle Infusionsoft interaction. I am closing this issue, as there is no way for me to test it further.