cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Refresh key does not work.

Refresh key does not work.

tritnguyen
Explorer | Level 3
Go to solution

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.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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!

View solution in original post

7 Replies 7

tritnguyen
Explorer | Level 3
Go to solution

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
Dropbox Staff
Go to solution

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
Explorer | Level 3
Go to solution

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
Dropbox Staff
Go to solution

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
Explorer | Level 3
Go to solution

I have a compile error on the function that using the class ListFolderBuilder when I use version 5.4.4 SDK. I think I have to re-write that function (any suggestion is welcome here). Other than that, the code above run fine with the 5.4.4 SDK.

 

Thank you.

Greg-DB
Dropbox Staff
Go to solution

Yes, that interface may have been updated in a version of the SDK after the one you were using. You can find the latest documentation here.

 

Anyway, I'm glad to hear this seems to resolve the main issue.

tritnguyen
Explorer | Level 3
Go to solution

Thank you very much.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    tritnguyen Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?