Post

1 follower Follow
0
Avatar

Podio authentication PHP api with refresh_token

I have a refresh_token returned after grant access occurs and I want to use that refresh token on a php page i'm calling using ajax.

$_POST['refresh_token']) contains that refresh token. What am i doing wrong to get this error:

---------------error-------------------

Fatal error: Uncaught exception 'PodioInvalidGrantError' in *PodioAPI.php:238 Stack trace: #0 *PodioAPI.php(143): Podio->request('POST', '/oauth/token', Array, Array) #1

*Podio->authenticate('refresh_token', Array) #2 {main} thrown in *PodioAPI.php on line 238

------------code to authenticate--------------

require_once 'podio-api/config.php';

require_once 'podio-api/PodioAPI.php';

$api = Podio::instance(CLIENT_ID, CLIENT_SECRET); 

$api->authenticate('refresh_token', array('refresh_token' => $_POST['refresh_token']));

James Trusler Answered

Please sign in to leave a comment.

13 comments

0
Avatar

The refresh token is handled automatically in the PHP Library. you shouldn't have to deal with it at all.

Also, there is a new much better version of the library, if it's not too much work for you I suggest you use that instead.

Carl-Fredrik Herö 0 votes
0
Avatar

To be clear, you do have to save and pass the refresh token to the library each time together with the access_token.

/* Using the old lib, untested code from my head */

$api = Podio::instance(CLIENT_ID, CLIENT_SECRET);

$api->oauth = new PodioOAuth($access_token, $refresh_token);

/* regular api calls, you don't need to authenticate as the lib will do it for you */

Carl-Fredrik Herö 0 votes
0
Avatar

Still no idea how to change my dam profile image... lmao. Fat booth ruined my life. It's not using the same as the normal Podio profile image.

James Trusler 0 votes
0
Avatar

Don't seem to have an account there? Tried the email address associated with the podio i'm currently logged into. "Whoops. We can't find that email address. Did you spell it correctly?"

Cheers though! 

James Trusler 0 votes
0
Avatar

As James say the client lib. should handle all refreshes for you automatically.

As for your avatar. Try logging out via this link https://help.podio.com/access/logout (this will log you out of Podio as well). Log back into Podio and go to the Help Center by clicking through from the topbar link inside Podio. That should reset your avatar over here.

Andreas Haugstrup Pedersen 0 votes
0
Avatar

That didn't work but once again, thanks for trying :)

Just to confirm, I pressed your link. logged back in, top bar i clicked through to the help forums. 

James Trusler 0 votes
0
Avatar

Andreas, I am getting this error today on on of my apps, just me... 

[Sorry, your OAuth grant has expired.]

And we are using the PHP libs... what do you suggest?  thanks...

Patrick Steil

http://www.podiotools.com

 

Patrick Steil 0 votes
0
Avatar

Weird... turns out this is happening with one specific item... it is very weird... ignore this for now, thanks... :)

Patrick Steil 0 votes