I have a Desktop/Mobile Xamarin application that reads and writes to the Apps folder in a users Dropbox. It has been working fine for a long time but now that Dropbox has moved to short-lived access tokens my application is having issues. It used to be when the application got the Dropbox token that was it unless the user uninstalled my application. I am using the Dropbox.Sdk .NET and C#.
My authentication code was like this:
this.oauth2State = Guid.NewGuid().ToString("N");
var authorizeUri = DropboxOAuth2Helper.GetAuthorizeUri(OAuthResponseType.Token, Constants.DropboxClientId, new Uri(Constants.DropboxRedirectUri), this.oauth2State);
var webView = new WebView { Source = new UrlWebViewSource { Url = authorizeUri.AbsoluteUri } };
webView.Navigating += this.WebViewOnNavigating;
var contentPage = new ContentPage { Content = webView };
await Shell.Current.Navigation.PushModalAsync(contentPage);
So how do I fix this so that it works with Dropbox's new process.
Do I need to start using both an AccessToken and a RefreshToken?
How do I change the above code to get both tokens?
And then how do I use those tokens so that the user does not need to keep logging into Dropbox from my application?
Has anyone got a .NET C# sample of how to read and write a file to a users Apps folder for an application since all this has changed?
Orgbrat