Closed Blacx closed 11 years ago
Hi @Blacx
You will need to delete the invalid token and re-authenticate. Which storage handler are you using? I'll try and replicate this issue.
Hi @BenTheDesigner ,
I've tried to delete a token record in the database and even tried to remove all the session even though I am using PDO storage. But still It can't, because the problem is I do not understand how and using what methods to do re-authentication. Thank's for your fast response.
Hi,
Re-authentication should simply be running one of the examples again. The storage object should fail to retrieve a token for you redirect to the authentication page.
If you've deleted the token from the database and from the session, it could suggest the token you deleted is not the correct one. Have you double checked there is no token stored for your user ID?
Hi @BenTheDesigner ,
The real problem occurs when I remove my application permissions from dropbox. Then I try to re-access the examples and hope to perform a page "Api Request Authorization" again from dropbox, but not so. All of the examples you have gives me an error "Token is invalid" and "Authentication failed".
Then I try to run $storage->delete() method, clear the records from the tables, and clean up all instances of session but still showing error.
Removing the application from Dropbox will cause the API to return a 401 and authentication will fail. This is the intended behaviour.
I have tested this morning by revoking access to my application, deleting the token form the database and clearing my session. Once this is done and I access the examples again, all works as expected.
Are you able to Pastebin the code that sets up the Dropbox objects and tries to delete the token?
Yes, I create the logout php:
<?php require_once('bootstrap.php'); $storage->delete(); // I'm using PDO storage session_unset(); session_destroy(); header('location:accountinfo.php'); ?>
cmiww.. :(
Thanks for the detailed description of the error. I'll investigate and get back to you, hopefully tonight but maybe tomorrow - sorry it can't be sooner.
I hope so. Thank you very much in advance.
Any progress on this guys? I'm running into the same issue..
Hi @Blacx & @henrylevak
Unfortunately I am unable to replicate this issue. When I revoke a token a \Dropbox\Exception is thrown as expected. I have modified the cURL consumer to use the response code as the Exception code so we can handle this.
I have also updated the accountInfo example to catch this Exception and handle it appropriately, deleting invalid tokens and re-authenticating. I've uploaded a video which demonstrates what happens when I revoke an access token using this updated example. See http://vimeo.com/57197882
Can I ask you both to try the example in commit fa4cc2e5bf and post your findings? If the problem persists are you able to provide details about your PHP version/OS?
Hi @BenTheDesigner ,
I have tried your update and it worked! on accountInfo.php, getFile.php, metaData.php, putStream.php, chunkedUpload.php, and shares.php, now an invalid token has been erased from the storage so that the re-auth has returned to work. (@henrylevak)
I am very grateful for your efforts in helping me. I think this issue should I close, but there are still issues which I will send it back to you. I'll create a new issue, please check back at.
For the future, I use the Windows 8 operating system and uses PHP version 5.3.1
Thank's
Hi @Blacx
There was no fundamental change to the library that would have fixed this, just the way the 401 returned from Dropbox was handled. Please send over the additional issues.
@BenTheDesigner Hey Ben, thanks for the quick turnaround on this. I can also confirm that the changes you made resolved my issue. Funny how we two of us ran into the exact same issue - almost at the same time. Thank you!
Dear @BenTheDesigner ,
I got this notice :
It happens when I revoke application from dropbox. Now I can not access all of the examples, although I've tried to recreate the token using the $storage-> delete (); method. Please help.