We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

tritnguyen's avatar
tritnguyen
Explorer | Level 3
3 years ago

Refresh key does not work.

Hi,

 

I created a trial account with the Business Advance Account; this account was used to test the features of Dropbox for my team. I created an app and wrote a test program to collect user’s information and monitor the event log using the Dropbox API Java SDK. The test program worked fine. When my trial ended, my company bought the Business Advance Account license for me and some others of my team. I created a Refresh token with information from App Key and App Secret as before. However, when I tried my test program to get the event log, I got the following errors:

 

com.dropbox.core.BadResponseException: Bad JSON: expected object value.

 at [Source: (sun.net.www.protocol.http.HttpURLConnection$HttpInputStream); line: 1, column: 47112]

               at com.dropbox.core.v2.DbxRawClientV2$1.execute(DbxRawClientV2.java:158)

               at com.dropbox.core.v2.DbxRawClientV2.executeRetriable(DbxRawClientV2.java:330)

               at com.dropbox.core.v2.DbxRawClientV2.executeRetriableWithRefresh(DbxRawClientV2.java:351)

               at com.dropbox.core.v2.DbxRawClientV2.rpcStyle(DbxRawClientV2.java:137)

               at com.dropbox.core.v2.teamlog.DbxTeamTeamLogRequests.getEvents(DbxTeamTeamLogRequests.java:47)

               at com.dropbox.core.v2.teamlog.DbxTeamTeamLogRequests.getEvents(DbxTeamTeamLogRequests.java:84)

 

I did not make any changes to my test program, just use it with the new refresh key; the new refresh key has a same scopes as the previous refresh key. So anybody having the same problem? Do you guys have any suggestions to fix it?

 

Thank you.

  • Greg-DB's avatar
    Greg-DB
    3 years ago

    That should be addressed in v5.4.4, per the release notes. Please give that a try and let us know if you run in to any issues. Thanks!

  • tritnguyen's avatar
    tritnguyen
    Explorer | Level 3

    My email address for the Business Advance Account license is different than my email address for the trial account. Note that if I am using the same Refresh Key, I can get the users information but not the  event log. This is the code:

     

    static public void getLogEvents(DbxTeamTeamLogRequests teamLog)
    {
    GetTeamEventsResult eventRes = null;

    try
    {
    eventRes = teamLog.getEvents(); //Connect and get events from DropBox server.
    eventCursor = eventRes.getCursor();
    }
    catch (DbxException e1)
    {
    e1.printStackTrace();
    }
    while(true)
    {
    List<TeamEvent> events = eventRes.getEvents();
    for(int i = 0; i < events.size(); i++)
    {
    TeamEvent event = events.get(i);
    System.out.println(event.toStringMultiline());
    }

    if(eventRes.getHasMore())
    {
    try
    {
    eventRes = teamLog.getEventsContinue(eventCursor);
    eventCursor = eventRes.getCursor();
    }
    catch (DbxException e)
    {
    e.printStackTrace();
    }
    }
    else
    {
    break;
    }
    }
    }

    static public void getUsers(DbxTeamTeamRequests team)
    {
    try
    {
    MembersListResult memberList = team.membersList();
    memberCursor = memberList.getCursor();

    while(true)
    {
    List<TeamMemberInfo> members = memberList.getMembers();
    for(int i = 0; i < members.size(); i++)
    {
    TeamMemberInfo member = members.get(i);
    System.out.println(member.toStringMultiline());
    }

    if(memberList.getHasMore())
    {
    try{
    memberList = team.membersListContinue(memberCursor);
    memberCursor = memberList.getCursor();
    }
    catch (DbxException e){
    e.printStackTrace();
    }
    }
    else
    {
    break;
    }
    }
    }
    catch (DbxException e)
    {
    throw new RuntimeException(e);
    }
    }

    public static void main(String args[]) throws IOException, DbxException {
    DbxCredential credential;

    Path path = Paths.get("C:\\tri\\proj\\features\\features\\outputKey.json");
    byte[] data = Files.readAllBytes(path);

    try
    {
    credential = DbxCredential.Reader.readFully(data);
    }
    catch (JsonReadException e)
    {
    throw new RuntimeException(e);
    }

    // Create a DbxTeamClientV2, which is what you use to make API calls.
    DbxRequestConfig requestConfig = new DbxRequestConfig(CONFIG_NAME);
    DbxTeamClientV2 dbxClient = new DbxTeamClientV2(requestConfig, credential);
    DbxTeamTeamLogRequests teamLog = dbxClient.teamLog();

    DbxTeamTeamRequests team = dbxClient.team();
    MembersListResult memberList = team.membersList();
    memberCursor = memberList.getCursor();

    getUsers(team); //OK, returning correct users information.
    getLogEvents(teamLog);
    }
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    This was a bug that could occur with versions before v5.3.0 of the Dropbox Java SDK. Please update to at least v5.3.0, or preferably the latest version, currently v5.4.4, and try again.

    • tritnguyen's avatar
      tritnguyen
      Explorer | Level 3

      I need the 4.x.x version because our application is using Java 8. To use version 5.x.x, I need to have Java 11+ which I cannot install it because our application will not compile with Java 11+. Can we have another way to resolve it?

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        That should be addressed in v5.4.4, per the release notes. Please give that a try and let us know if you run in to any issues. Thanks!

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 2 hours ago
325 Following

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 or Facebook.

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!