How to get access token from the DBAccountManager.SharedManager.HandleOpenURL("url") using dropnet ? or any other alternative way to get the access token
DBAccountManager.SharedManager.HandleOpenURL("url")
When you say "dropnet," are you referring to the .NET library (https://github.com/DropNet/DropNet)?
If you're migrating from the Sync API, take a look at https://blogs.dropbox.com/developers/2015/05/migrating-sync-sdk-access-tokens-to-core-sdk/ for details about how to extract the existing access token.
Yes I'm referring to this (https://github.com/DropNet/DropNet) only ,I use the following code but I'm getting an weird exception "Object reference not set to an instance of an object"
string apikey = dropvalues.DropboxApiKey; string apisecretkey = dropvalues.DropboxApiSecretKey; string usertoken = dropvalues.DropBoxUserToken; string usersecrettoken = dropvalues.DropBoxUserSecretKey; DropNetClient client = new DropNetClient(apikey, apisecretkey, usertoken, usersecrettoken); // client.GetTokenAndBuildUrl(uri); var accesskey = client.GetAccessToken(); Debug.WriteLine("Access key is " + accesskey);
What object reference is not set to an instance of an object?
Also, cross-referencing your post on Stack Overflow: http://stackoverflow.com/questions/30366944/how-to-get-access-token-from-dropbox-sync-datastore-xamarin-component.
I have resolved the object reference exception now i got this one
DropBoxIntegration[3831:508119] Stack Trace at DropNet.DropNetClient.Execute (ApiType apiType, IRestRequest request) [0x0002c]
In the following URL which is the access key
{db-XXXXXXX://1/connect?oauth_token_secret=XXXXXXXX&state=XXXXXXXXXXXXX&uid=XXXXXXX&oauth_token=XXXXXXXXXXX}
?
I'm not familiar with the term "access key," but if you're asking about an "access token," that's a term associated with OAuth 2, while the URL you have is dealing with OAuth 1. In OAuth 1, you get an token (oauth_token) and a token secret (oauth_token_secret). If you need to convert that to an OAuth 2 access token, you can use the https://www.dropbox.com/developers/core/docs#oa2-from-oa1 endpoint.
oauth_token
oauth_token_secret
That said, I'm pretty sure the version of DropNet you're using only supports OAuth 1, so you should probably stick with the token and token secret that you have. (Your code looks good to me up until the call to GetAccessToken.)
GetAccessToken