Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linkedin tokens expire in a day instead of 60 days

Linkedin's API documentation states that the access token granted lasts for 60 days, but in some cases I've seen it expire within a day. Once we drive the user through the authentication process to get the access token, we are able to post on their page. But when we try posting for them the next day, the API returns an error "Unable to verify access token". There are pages where I don't see this issue and I've been posting for the last couple of weeks. My issue is that I can't figure out the difference between the pages where the tokens expire in a day and where they don't. Help?

like image 772
sujit Avatar asked Sep 06 '17 18:09

sujit


1 Answers

I have seen the behaviour you describe only when after an authorization the access token was not updated in our db. An authorization will invalidate the previous token and the API calls will return that message.

Edit- response to comment: Make sure the database is updated with the tokens after each user authentication, ensure that the user is not going over the authentication again in some other place in the app without saving token (or requesting different permissions) because those two cases will generate that error message.

like image 133
s1mpl3 Avatar answered Nov 15 '22 18:11

s1mpl3