Search code examples
androidonedrive

Android - how to get access token of one drive


Account account = new Account("[email protected]", "com.microsoft.skydrive");

AccountManagerFuture accFut = AccountManager.get(this).
getAuthToken(account, "sh", null, this, null, null);

Bundle authTokenBundle = (Bundle) accFut.getResult();

String authToken = authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString();

This code is not working..


Solution

  • If you want to integrate your Android app with OneDrive, you can start with OneDrive Android SDK. Simply you can get an access token in your app by

    oneDriveClient.getAuthenticator().getAccountInfo().getAccessToken();