简体   繁体   中英

How to Obtain request_token from dropbox

The Request Token and Token Secret MUST be exchanged for an Access Token and Token Secret.

To request an Access Token, the Consumer makes an HTTP request to the Service Provider's Access Token URL. The Service Provider documentation specifies the HTTP method for this request, and HTTP POST is RECOMMENDED. The request MUST be signed per Signing Requests, and contains the following parameters:

oauth_consumer_key: The Consumer Key. oauth_token: The Request Token obtained previously. oauth_signature_method: The signature method the Consumer used to sign the request. oauth_signature: The signature as defined in Signing Requests. oauth_timestamp: As defined in Nonce and Timestamp. oauth_nonce: As defined in Nonce and Timestamp.

how to get these parameters in java

        AppKeyPair appKeys = new AppKeyPair("INSERT_APP_KEY_HERE", "INSERT_SECRET_HERE"); //Both from Dropbox developer website
        WebAuthSession session = new WebAuthSession(appKeys, Session.AccessType.DROPBOX);

        DropboxAPI<WebAuthSession> mDBApi = new DropboxAPI<WebAuthSession>(session);
        System.out.println(mDBApi.getSession().getAuthInfo().url);

The URL contains all the information need I believe.

Dropbox API downloaded form here:
https://www.dropbox.com/developers/reference/sdk

Go here to get App key information:
https://www.dropbox.com/developers/apps (Must sign in to dropbox and create new app)

You don't need all the extra stuff other than oauth_token if you connect over https.

If you're using the HTTP API directly, you can get a request token via the /oauth/request_token call.

Instead of using the HTTP API directly, you might find it easier to use the official Java SDK for Dropbox . Documentation on the OAuth flow: WebAuthSession.java .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM