Forum Discussion

vignesh p.'s avatar
vignesh p.
New member | Level 1
11 years ago

Dropbox Sync API access token

How to get access token from the DBAccountManager.SharedManager.HandleOpenURL("url") using dropnet ? or any other alternative way to get the access token

6 Replies

Replies have been turned off for this discussion
  • vignesh p.'s avatar
    vignesh p.
    New member | Level 1
    11 years ago

    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);
    
  • vignesh p.'s avatar
    vignesh p.
    New member | Level 1
    11 years ago

    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]
    
  • vignesh p.'s avatar
    vignesh p.
    New member | Level 1
    11 years ago

    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 /token_from_oauth1 endpoint.

    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.)

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!