OAuth Problem - Access token invalid when refreshing page (Invalid / expired Token /oauth/access_token)


I am using curl() to build this php (actually, from the online source code) and it works fine. After I have get the access_token and directed to a page :

Everything still works fine, I can grab the home timeline and output it at this page, BUT when I click on F5(refresh), then error occurs:

"errors":[{"message":"Bad Authentication data","code":215}]

and I find it was because of the access token :

array(8) { [" string(144) ""1.0" encoding="UTF-8"?> Invalid / expired Token /oauth/access_token?oauth_consumer_key=XXXXXXXXXXXXXXXXXXX" ["amp;oauth_nonce"]=> string(32) "XXXXXXXXXXXXXXXXXXXXXXXXXXXX" ["amp;oauth_signature"]=> string(28) "XXXXXXXXXXXXXXXXXXXXX/YYYYYY=" ["amp;oauth_signature_method"]=> string(9) "HMAC-SHA1" ["amp;oauth_timestamp"]=> string(10) "XXXXXXXXXXXX" ["amp;oauth_token"]=> string(42) "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ["amp;oauth_verifier"]=> string(43) "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ["amp;oauth_version"]=> string(22) "1.0 " }

Anyone got the solution?
Thank you.


I am having a similar problem. My app calls requestToken on page load, and when I make my first request using that token, it gets the correct answer, but adds a popup of the “https://api.twitter.com/oauth/authorize?oauth_token=XXXXXXXXXXXXXXXXXXXXXXXXX” page. so everything works, but that page is there.