CLOUD: Update Dropbox to use refresh_token
Dropbox is switching to short-lived access_token OAuth. This commit adapts Cloud::DropboxStorage to use refresh_token similarly to how other Storages do: by introducing a DropboxTokenRefresher. It is used instead of plain CurlJsonRequest. It just checks if received JSON has access_token-related error and tries to refresh it, then repeats the original request transparently for the caller. If no such errors found, it just passes the info to the caller.
This commit is contained in:
parent
a7776e9ef2
commit
8c16575035
14 changed files with 245 additions and 39 deletions
|
@ -31,8 +31,10 @@
|
|||
namespace Cloud {
|
||||
namespace Dropbox {
|
||||
|
||||
class DropboxStorage;
|
||||
|
||||
class DropboxUploadRequest: public Networking::Request {
|
||||
Common::String _token;
|
||||
DropboxStorage *_storage;
|
||||
Common::String _savePath;
|
||||
Common::SeekableReadStream *_contentsStream;
|
||||
Storage::UploadCallback _uploadCallback;
|
||||
|
@ -47,7 +49,7 @@ class DropboxUploadRequest: public Networking::Request {
|
|||
void finishUpload(StorageFile status);
|
||||
|
||||
public:
|
||||
DropboxUploadRequest(Common::String token, Common::String path, Common::SeekableReadStream *contents, Storage::UploadCallback callback, Networking::ErrorCallback ecb);
|
||||
DropboxUploadRequest(DropboxStorage *storage, Common::String path, Common::SeekableReadStream *contents, Storage::UploadCallback callback, Networking::ErrorCallback ecb);
|
||||
virtual ~DropboxUploadRequest();
|
||||
|
||||
virtual void handle();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue