Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection need Token refresh #135

Open
m-holstein opened this issue Jul 9, 2022 · 2 comments
Open

Connection need Token refresh #135

m-holstein opened this issue Jul 9, 2022 · 2 comments

Comments

@m-holstein
Copy link

Hi,
is there a solution for the token expiring?
Dropbox does retired the long live tokens.

In the current state the Dropbox storage is useless.

After a while the client gets a Unauthorized
https://dropbox.tech/developers/migrating-app-permissions-and-access-tokens

@jnweiger
Copy link
Contributor

jnweiger commented Aug 1, 2022

Hello @m-holstein , thanks for your report.

I tried to reproduce. It seems the connection is working fine for a while, and (a few hours later?) it fails with permission denied.
Can you confirm this also what you see?

The owncloud.log has:

{"reqId":"YueJ@pRO37tmmURCS1m3ggAAAAk","level":3,"time":"2022-08-01T08:08:27+00:00","remoteAddr":"89.204.135.225","user":"admin","app":"files_external_dropbox","method":"PUT","url":"/index.php/apps/files_external/globalstorages/3","message":"Exception: {"Exception":"Kunnu\\Dropbox\\Exceptions\\DropboxClientException","Message":"{\"error_summary\": \"expired_access_token\/..\", \"error\": {\".tag\": \"expired_access_token\"}}","Code":401,"Trace":"#0 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/kunalvarma05\/dropbox-php-sdk\/src\/Dropbox\/DropboxClient.php(161): Kunnu\\Dropbox\\Http\\Clients\\DropboxGuzzleHttpClient->send()\n#1 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/kunalvarma05\/dropbox-php-sdk\/src\/Dropbox\/Dropbox.php(273): Kunnu\\Dropbox\\DropboxClient->sendRequest()\n#2 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/kunalvarma05\/dropbox-php-sdk\/src\/Dropbox\/Dropbox.php(243): Kunnu\\Dropbox\\Dropbox->sendRequest()\n#3 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/kunalvarma05\/dropbox-php-sdk\/src\/Dropbox\/Dropbox.php(1227): Kunnu\\Dropbox\\Dropbox->postToAPI()\n#4 \/var\/www\/owncloud\/apps\/files_external_dropbox\/lib\/Storage\/Dropbox.php(209): Kunnu\\Dropbox\\Dropbox->getCurrentAccount()\n#5 \/var\/www\/owncloud\/lib\/private\/Files\/External\/LegacyUtil.php(207): OCA\\Files_external_dropbox\\Storage\\Dropbox->test()\n#6 \/var\/www\/owncloud\/apps\/files_external\/lib\/Controller\/StoragesController.php(254): OC\\Files\\External\\LegacyUtil::getBackendStatus()\n#7 \/var\/www\/owncloud\/apps\/files_external\/lib\/Controller\/GlobalStoragesController.php(189): OCA\\Files_External\\Controller\\StoragesController->updateStorageStatus()\n#8 \/var\/www\/owncloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(170): OCA\\Files_External\\Controller\\GlobalStoragesController->update()\n#9 \/var\/www\/owncloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(89): OC\\AppFramework\\Http\\Dispatcher->executeController()\n#10 \/var\/www\/owncloud\/lib\/private\/AppFramework\/App.php(100): OC\\AppFramework\\Http\\Dispatcher->dispatch()\n#11 \/var\/www\/owncloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(47): OC\\AppFramework\\App::main()\n#12 \/var\/www\/owncloud\/lib\/private\/Route\/Router.php(344): OC\\AppFramework\\Routing\\RouteActionHandler->__invoke()\n#13 \/var\/www\/owncloud\/lib\/base.php(914): OC\\Route\\Router->match()\n#14 \/var\/www\/owncloud\/index.php(54): OC::handleRequest()\n#15 {main}","File":"\/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/kunalvarma05\/dropbox-php-sdk\/src\/Dropbox\/Http\/Clients\/DropboxGuzzleHttpClient.php","Line":59}"}
{"reqId":"YueJ@pRO37tmmURCS1m3ggAAAAk","level":3,"time":"2022-08-01T08:08:27+00:00","remoteAddr":"89.204.135.225","user":"admin","app":"files_external_dropbox","method":"PUT","url":"/index.php/apps/files_external/globalstorages/3","message":"Caused by: {"Exception":"GuzzleHttp\\Exception\\ClientException","Message":"Client error: POST https:\\\/\\\/api.dropboxapi.com\\\/2\\\/users\\\/get_current_account resulted in a 401 Unauthorized response:\n{\"error_summary\": \"expired_access_token\/..\", \"error\": {\".tag\": \"expired_access_token\"}}\n","Code":401,"Trace":"#0 \/var\/www\/owncloud\/lib\/composer\/guzzlehttp\/guzzle\/src\/Middleware.php(69): GuzzleHttp\\Exception\\RequestException::create()\n#1 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/guzzlehttp\/promises\/src\/Promise.php(204): GuzzleHttp\\Middleware::GuzzleHttp\\{closure}(*** sensitive parameters replaced )\n#2 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/guzzlehttp\/promises\/src\/Promise.php(153): GuzzleHttp\\Promise\\Promise::callHandler()\n#3 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/guzzlehttp\/promises\/src\/TaskQueue.php(48): GuzzleHttp\\Promise\\Promise::GuzzleHttp\\Promise\\{closure}( sensitive parameters replaced ***)\n#4 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/guzzlehttp\/promises\/src\/Promise.php(248): GuzzleHttp\\Promise\\TaskQueue->run()\n#5 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/guzzlehttp\/promises\/src\/Promise.php(224): GuzzleHttp\\Promise\\Promise->invokeWaitFn()\n#6 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/guzzlehttp\/promises\/src\/Promise.php(269): GuzzleHttp\\Promise\\Promise->waitIfPending()\n#7 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/guzzlehttp\/promises\/src\/Promise.php(226): GuzzleHttp\\Promise\\Promise->invokeWaitList()\n#8 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/guzzlehttp\/promises\/src\/Promise.php(62): GuzzleHttp\\Promise\\Promise->waitIfPending()\n#9 \/var\/www\/owncloud\/lib\/composer\/guzzlehttp\/guzzle\/src\/Client.php(123): GuzzleHttp\\Promise\\Promise->wait()\n#10 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/kunalvarma05\/dropbox-php-sdk\/src\/Dropbox\/Http\/Clients\/DropboxGuzzleHttpClient.php(57): GuzzleHttp\\Client->send()\n#11 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/kunalvarma05\/dropbox-php-sdk\/src\/Dropbox\/DropboxClient.php(161): Kunnu\\Dropbox\\Http\\Clients\\DropboxGuzzleHttpClient->send()\n#12 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/kunalvarma05\/dropbox-php-sdk\/src\/Dropbox\/Dropbox.php(273): Kunnu\\Dropbox\\DropboxClient->sendRequest()\n#13 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/kunalvarma05\/dropbox-php-sdk\/src\/Dropbox\/Dropbox.php(243): Kunnu\\Dropbox\\Dropbox->sendRequest()\n#14 \/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/kunalvarma05\/dropbox-php-sdk\/src\/Dropbox\/Dropbox.php(1227): Kunnu\\Dropbox\\Dropbox->postToAPI()\n#15 \/var\/www\/owncloud\/apps\/files_external_dropbox\/lib\/Storage\/Dropbox.php(209): Kunnu\\Dropbox\\Dropbox->getCurrentAccount()\n#16 \/var\/www\/owncloud\/lib\/private\/Files\/External\/LegacyUtil.php(207): OCA\\Files_external_dropbox\\Storage\\Dropbox->test()\n#17 \/var\/www\/owncloud\/apps\/files_external\/lib\/Controller\/StoragesController.php(254): OC\\Files\\External\\LegacyUtil::getBackendStatus()\n#18 \/var\/www\/owncloud\/apps\/files_external\/lib\/Controller\/GlobalStoragesController.php(189): OCA\\Files_External\\Controller\\StoragesController->updateStorageStatus()\n#19 \/var\/www\/owncloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(170): OCA\\Files_External\\Controller\\GlobalStoragesController->update()\n#20 \/var\/www\/owncloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(89): OC\\AppFramework\\Http\\Dispatcher->executeController()\n#21 \/var\/www\/owncloud\/lib\/private\/AppFramework\/App.php(100): OC\\AppFramework\\Http\\Dispatcher->dispatch()\n#22 \/var\/www\/owncloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(47): OC\\AppFramework\\App::main()\n#23 \/var\/www\/owncloud\/lib\/private\/Route\/Router.php(344): OC\\AppFramework\\Routing\\RouteActionHandler->__invoke()\n#24 \/var\/www\/owncloud\/lib\/base.php(914): OC\\Route\\Router->match()\n#25 \/var\/www\/owncloud\/index.php(54): OC::handleRequest()\n#26 {main}","File":"\/var\/www\/owncloud\/apps\/files_external_dropbox\/vendor\/guzzlehttp\/guzzle\/src\/Exception\/RequestException.php","Line":113}"}
{"reqId":"YueJ@5RO37tmmURCS1m3gwAAAAk","level":0,"time":"2022-08-01T08:08:27+00:00","remoteAddr":"89.204.135.225","user":"admin","app":"OC\User\Session::validateToken","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v1/notifications?format=json","message":"token 6bffcb506fce651cd21743a74814d0af7ad4e2078d64228306832138319dc213ecf1545116cf56a4d8e458f29291b97c50b9b13dd58b839c178688f0995bed00 with token id 4 found, validating"}

@jnweiger
Copy link
Contributor

jnweiger commented Aug 1, 2022

With the existing 1.2.0 release, I repeatedly get the situation, that the connection to dropbox is broken after a few hours.

Another somewhat different variant in the log:

{"reqId":"Yuf9qgaHmHIPxZpj_fUNWgAAAAk","level":3,"time":"2022-08-01T16:22:02+00:00","remoteAddr":"82.113.121.75","user":"admin","app":"files_external_dropbox","method":"PUT","url":"\/index.php\/apps\/files_external\/globalstorages\/4","messag
e":"Exception: {\"Exception\":\"Kunnu\\\\Dropbox\\\\Exceptions\\\\DropboxClientException\",\"Message\":\"Client error response [url] https:\\\/\\\/api.dropboxapi.com\\\/2\\\/users\\\/get_current_account [status code] 401 [reason phrase] Unauthorized\",\"Code\":401,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_external_dropbox\\\/vendor\\\/kunalvarma05\\\/dropbox-php-sdk\\\/src\\\/Dropbox\\\/DropboxClient.php(161): Kunnu\\\\Dropbox\\\\Http\\\\Clients\\\\DropboxGuzzleHttpClient->send()\\n#1 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_external_dropbox\\\/vendor\\\/kunalvarma05\\\/dropbox-php-sdk\\\/src\\\/Dropbox\\\/Dropbox.php(269): Kunnu\\\\Dropbox\\\\DropboxClient->sendRequest()\\n#2 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_external_dropbox\\\/vendor\\\/kunalvarma05\\\/dropbox-php-sdk\\\/src\\\/Dropbox\\\/Dropbox.php(239): Kunnu\\\\Dropbox\\\\Dropbox->sendRequest()\\n#3 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_external_dropbox\\\/vendor\\\/kunalvarma05\\\/dropbox-php-sdk\\\/src\\\/Dropbox\\\/Dropbox.php(1208): Kunnu\\\\Dropbox\\\\Dropbox->postToAPI()\\n#4 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_external_dropbox\\\/lib\\\/Storage\\\/Dropbox.php(209): Kunnu\\\\Dropbox\\\\Dropbox->getCurrentAccount()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/External\\\/LegacyUtil.php(207): OCA\\\\Files_external_dropbox\\\\Storage\\\\Dropbox->test()\\n#6 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_external\\\/lib\\\/Controller\\\/StoragesController.php(254): OC\\\\Files\\\\External\\\\LegacyUtil::getBackendStatus()\\n#7 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_external\\\/lib\\\/Controller\\\/GlobalStoragesController.php(189): OCA\\\\Files_External\\\\Controller\\\\StoragesController->updateStorageStatus()\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(170): OCA\\\\Files_External\\\\Controller\\\\GlobalStoragesController->update()\\n#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(100): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch()\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Route\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke()\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(928): OC\\\\Route\\\\Router->match()\\n#14 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleRequest()\\n#15 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/files_external_dropbox\\\/vendor\\\/kunalvarma05\\\/dropbox-php-sdk\\\/src\\\/Dropbox\\\/Http\\\/Clients\\\/DropboxGuzzleHttpClient.php\",\"Line\":66}"}
{"reqId":"Yuf9qgaHmHIPxZpj_fUNWwAAAAk","level":0,"time":"2022-08-01T16:22:02+00:00","remoteAddr":"82.113.121.75","user":"admin","app":"OC\\User\\Session::validateToken","method":"GET","url":"\/ocs\/v2.php\/apps\/notifications\/api\/v1\/notifi
cations?format=json","message":"token c8b9de303a2327369f85fa70097eca345d3d79b43ecb615877de7334c7058a0bd85b15fc2f542581e4f2baafc4496d6d7383ca6f9ef0a9ce5c675b5847de7999 with token id 9 found, validating"}

With the upcoming 2.0.0-rc.2 release, we pull in updated depenendencies, including new code for refresh tokens.
No disconnects so far with this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants