OneDrive / onedrive-sdk-csharp

OneDrive SDK for C#! https://dev.onedrive.com
Other
294 stars 143 forks source link

Upload and Download Files in Background #167

Closed NPadrutt closed 8 years ago

NPadrutt commented 8 years ago

Hi I would like to make a task who syncs a file with OneDrive in the background. As far as I know the problem is the login since it uses the UI Thread to login (?). So is there a way to authenticate with the OneDrive Service in the background?

Currently I use this for the authentication:

oneDriveClient = OneDriveClientExtensions.GetUniversalClient(ServiceConstants.Scopes); await oneDriveClient.AuthenticateAsync();

My guess is, that I have to space the oauth token and then resend it when I access in the background. Is that correct so far and is there a way to do that?

Thanks for your help! =)

cdmayer commented 8 years ago

It would appear you are using the older version of the SDK (1.2 or earlier), which is not fully supported, but I can make some recommendations about doing the same task in the new version of the SDK (2.0).

The Auth Adapter library (used to authenticate in SDK v2.0) has a credential cache which will take care of all of this for you automatically. Please try upgrading to v2.0 and using that CredentialVault, and go from there. Let me know if you have any questions.

NPadrutt commented 8 years ago

Aaah, I see. I plan to update. But I use IsAuthenticated property who isn't available anymore. But then I try to upgrade tomorrow and try it again.

Thanks :)

cdmayer commented 8 years ago

Any updates for us? Or can I close the issue? I know you have opened some others.

NPadrutt commented 8 years ago

Currently it doesn't work. But I have to adjust some of my code for it first. I close the issue for now and would reopen it when I have an issue.

thanks! :)