Reputation: 11782
I am using following code to authenticate with dropbox
AppKeyPair appKeys = new AppKeyPair(Constants.DROPBOX_APPKEY, Constants.DROPBOX_APPSECRET);
AndroidAuthSession session = new AndroidAuthSession(appKeys);
mDBApi = new DropboxAPI<AndroidAuthSession>(session);
mDBApi.getSession().startOAuth2Authentication(this);
Once done
i call
mDBApi.getSession().finishAuthentication();
Account dropboxAccount = mDBApi.accountInfo();
String name = dropboxAccount.displayName;
AccessTokenPair pair = mDBApi.getSession().getAccessTokenPair();
String accessToken = mDBApi.getSession().getOAuth2AccessToken();
String accessTokenSecret = pair.secret;
However AccessTokenPair is null. How else am i suppose to get accessTokenSecret
?
Upvotes: 0
Views: 409
Reputation: 16930
In the Dropbox Android Core SDK, the getAccessTokenPair
method returns an OAuth 1 access token, if you have one, as an AccessTokenPair
. The getOAuth2AccessToken
returns an OAuth 2 access token, if you have one. Note that OAuth 2 access tokens are only one piece (i.e, basically just one string) while OAuth 1 access tokens have two pieces (key and secret).
Since you are using startOAuth2Authentication
, you only have an OAuth 2 access token, and getAccessTokenPair
won't return anything.
Upvotes: 1