RikyTres
RikyTres

Reputation: 676

Get Dropbox accessToken using DbxWebAuth.finish method

I'm trying to complete the oAuth2 trip to get the AccessToken.

I followed this official guide to understand how Java API works, and I'm using the documentation to understand how class work together, but I'm not able to understand how com.dropbox.core.DbxWebAuth#finish(Map<String, String[]> queryParams).

I don't understand which values give to queryParams. Do someone explain me?

PS: This is some code that I write to retrive the access token.

String accessToken(String code, String state, DbxWebAuth webAuth) {
    DbxAuthFinish authFinish = webAuth.finish(????);
    return authFinish.accessToken;
}

Upvotes: 0

Views: 785

Answers (1)

Greg
Greg

Reputation: 16930

The Dropbox Java Core SDK tutorial does use DbxWebAuthNoRedirect which has a different finish method than DbxWebAuth:

DbxWebAuthNoRedirect.finish
DbxWebAuth.finish

The DbxWebAuth.finish documentation has the following for queryParams:

queryParams - The query parameters on the GET request to your redirectUri.

For a sample of how to use it, the web-file-browser example app included with the SDK uses DbxWebAuth.finish as such:

    DbxAuthFinish authFinish;
    try {
        authFinish = getWebAuth(request).finish(request.getParameterMap());
    }

Upvotes: 1

Related Questions