xybu / onedrive-d-old

Microsoft OneDrive client on Linux.
http://xybu.me/projects/onedrive-d/
GNU Lesser General Public License v3.0
819 stars 142 forks source link

Automatically renew access token on expiration #76

Closed kpj closed 10 years ago

kpj commented 10 years ago

After running main.py for a while, it always crashes with

Exception in thread syncer:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/home/kpj/onedrive-d/onedrive_d/daemon.py", line 674, in run
    self.merge_dir(entry)
  File "/home/kpj/onedrive-d/onedrive_d/daemon.py", line 516, in merge_dir
    all_remote_items = self.api.list_entries(remote_path)
  File "/home/kpj/onedrive-d/onedrive_d/live_api.py", line 194, in list_entries
    return self.parse_response(r, ProtocolError)['data']
  File "/home/kpj/onedrive-d/onedrive_d/live_api.py", line 64, in parse_response
    raise error(ret)
live_api.ProtocolError: 'request_token_expired: The access token that was provided has expired.'

Wouldn't it make sense to catch that error and renew the token?

xybu commented 10 years ago

Two commits are about this: fdd92b6b3f6cb1d6d7be249df73a8c28b844d422 a488b25dc0726e150fc2b1bb599df375031f63c0

I tried token expiration during file listing, but haven't tested if the expiration handler in file getting / putting works.

kpj commented 10 years ago

Cool, it doesn't crash anymore. Unfortunately, I am still getting that error message:

[2014-10-14T12:43:06+0200] syncer   INFO: syncing <file>
[2014-10-14T12:43:06+0200] syncer   ERROR: AuthError: 'request_token_expired: The access token that was provided has expired.'

Is that the error raised in here?

Shouldn't that line commence a reconnect by, e.g. catching and handling that error somewhere?

xybu commented 10 years ago

Don't worry that's just a line of log telling us the error was caught.

Sincerely, Xiangyu Bu

Sent from my Windows Phone


From: kpjmailto:notifications@github.com Sent: ‎10/‎14/‎2014 6:49 AM To: xybu/onedrive-dmailto:onedrive-d@noreply.github.com Cc: Xiangyu Bumailto:xybu92@live.com Subject: Re: [onedrive-d] Automatically renew access token on expiration (#76)

Cool, it doesn't crash anymore. Unfortunately, I am still getting that error message:

[2014-10-14T12:43:06+0200] syncer       INFO: syncing <file>
[2014-10-14T12:43:06+0200] syncer       ERROR: AuthError: 'request_token_expired: The access token that was provided has expired.'

Is that the error raised in here?

Shouldn't that line commence a reconnect by, e.g. catching and handling that error somewhere?


Reply to this email directly or view it on GitHub: https://github.com/xybu/onedrive-d/issues/76#issuecomment-59021706

kpj commented 10 years ago

But I am getting it for every file (after some amount of time). So the reconnection does not seem to work.

xybu commented 10 years ago

I guess the token in use isn't replaced by the new one. Let me think about the logic.

Sincerely, Xiangyu Bu

Sent from my Windows Phone


From: kpjmailto:notifications@github.com Sent: ‎10/‎14/‎2014 12:53 PM To: xybu/onedrive-dmailto:onedrive-d@noreply.github.com Cc: Xiangyu Bumailto:xybu92@live.com Subject: Re: [onedrive-d] Automatically renew access token on expiration (#76)

But I am getting it for every file (after some amount of time). So the reconnection does not seem to work.


Reply to this email directly or view it on GitHub: https://github.com/xybu/onedrive-d/issues/76#issuecomment-59078273

xybu commented 10 years ago

I understand. The global tokens have been updated, but the API object's doesn't .Let me fix this.

xybu commented 10 years ago

a57d0610d2a73feac65186b09f0ddb5c4bc6c74c