Reputation: 29277
I tried to using the new API sharpbox 1.2.
I tried this code:
if (Request.UrlReferrer.ToString() == string.Empty)
{
DropBoxConfiguration config = DropBoxConfiguration.GetStandardConfiguration();
config.AuthorizationCallBack = new Uri("http://localhost:60003/Default.aspx");
DropBoxRequestToken token = DropBoxStorageProviderTools.GetDropBoxRequestToken(config, "customerkey", "customersecret");
string authUrl = DropBoxStorageProviderTools.GetDropBoxAuthorizationUrl(config, token);
Response.Redirect(authUrl);
}
else
{
ICloudStorageAccessToken token1 = DropBoxStorageProviderTools.LoginWithMobileAPI("username", "password", "customerkey", "customersecret");
}
But I got an Exception like this:
"Attempted to perform an unauthorized operation"
I'm using Asp.NET & C#
Thanks a lot!
Upvotes: 0
Views: 1965
Reputation: 33
Sharpbox 1.2 eliminated the username/password pass. You must use the ICloudStorageAccessToken to get your token. There is a standalone exe in the download to turn your consumerkey and consumersecret into a token.
Public dropBoxStorage As CloudStorage
dropBoxStorage = New CloudStorage()
Dim dropBoxConfiguration As ICloudStorageConfiguration = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.DropBox)
Dim accesstoken As ICloudStorageAccessToken = Nothing
Dim tokenpath As String = serverpath
Dim fs As FileStream = File.Open(tokenpath, FileMode.Open, FileAccess.Read, FileShare.Read)
accesstoken = dropBoxStorage.DeserializeSecurityToken(fs)
dropBoxStorage.Open(dropBoxConfiguration, accesstoken)
Upvotes: 2