Join BoxWorks in San Francisco Nov 12-13! Keynotes, product demos, and Box Master Classes. Reserve your spot!

Comments

4 comments

  • kendomen

    Here's an example

     

    BoxDeveloperEditionAPIConnection api = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(
                    ENTERPRISE_ID, CLIENT_ID, CLIENT_SECRET, encryptionPref, accessTokenCache);
    
            Iterable managedUsers = BoxUser.getAllEnterpriseUsers(api, "***email address removed for privacy***");
            for (BoxUser.Info managedUser : managedUsers) {
                System.out.println(managedUser.getName() + " " + managedUser.getStatus());
                if (managedUser.getStatus().equals(BoxUser.Status.ACTIVE)) {
    
                    // Used to get AppUser or ManagedUser
                    BoxDeveloperEditionAPIConnection userApi = BoxDeveloperEditionAPIConnection.getAppUserConnection(managedUser.getID(), CLIENT_ID, CLIENT_SECRET, encryptionPref, accessTokenCache);
    
                    BoxItem.Info boxItem = BoxFolder.getSharedItem(api, "https://hpdnyc.app.box.com/s/zjq4iwixgn44gvqt43ou4jmiqfehemkc");
                    BoxFolder publicFolder = (BoxFolder)boxItem.getResource();
                    Iterable items = publicFolder.getChildren();
                    for (BoxItem.Info item : items) {
                        System.out.println("\t" + item.getName());
                    }
                }
            }
    0
    Comment actions Permalink
  • vineethmup2

     I was able to get the enterpise acess token, but not the user tokens. I tried to user tokens by OATH with JWT. 

    I am getting "Cannot obtain user token based on the enterpise configuration for your app?"  error when trying to authenicate on behalf of user.

    0
    Comment actions Permalink
  • kendomen

    I think you may need to set the scope in your app.  Here's what I have

     

    scope.png

    0
    Comment actions Permalink
  • vineethmup2

    Thank you very much  ! for helping me out

    0
    Comment actions Permalink

Please sign in to leave a comment.