cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We've been busy working on some major updates to the Community, so check out what's changing, what’s staying the same and what you can expect from the Dropbox Community right 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: 

Re: Auth webpage not available

Auth redirect url

eyra
New member | Level 2
Go to solution

Why does the redirect url after the Authorization process look like "#access_token=IuAX.........".

The # at the start prevents my server code from getting the url parameters. Using

.request().queryString()

in java

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution
That's the OAuth 2 "token" flow, where the access token is returned on the redirect URI fragment. That's meant more for client-side apps. For server-side apps, you should use the "code" flow. You can find more information here:

https://www.dropbox.com/developers/documentation/http/documentation#authorization

View solution in original post

9 Replies 9

Rich
Super User II
Go to solution
Moved to the API forum.

Greg-DB
Dropbox Staff
Go to solution
That's the OAuth 2 "token" flow, where the access token is returned on the redirect URI fragment. That's meant more for client-side apps. For server-side apps, you should use the "code" flow. You can find more information here:

https://www.dropbox.com/developers/documentation/http/documentation#authorization

david48
New member | Level 2
Go to solution

How would a native mobile client get access to this value?

Greg-DB
Dropbox Staff
Go to solution

@david48 Exactly how this works will depend on your particular scenario. For instance, for a locally running native mobile client, it can use a custom local URL scheme in its redirect URI. The app would register for that local URL scheme, so the redirect would be sent directly to the app (i.e., not a remote web server), where the app can parse the token from the fragment of the URL.

 

We recommend using one of the official SDKs, if possible, as they do most of the work for you:

 

https://www.dropbox.com/developers/documentation 

schrettinger
Explorer | Level 3
Go to solution

Hello,

 

when i'm trying to get access token in my android app java with

Auth.startOAuth2Authentication(this, "55556756765765756");

and then i click on ALLOW after DropBox login i get the Error

webpage not available the webpage db-appkey ... could not be loaded.

net::ERRUNKNOWN_URL_SCHEME

Can you please help me to find a solution.

 

Best regards

Manfred

 

tahsini
Dropbox Staff
Go to solution

@schrettinger in your startOAuth2Authentication function are you providing the correct app key taken from your App Console? The example you provided with "55556756765765756" does not seem to be a valid app key format.

schrettinger
Explorer | Level 3
Go to solution

Hello,

thanks for your answer.

 

I'm using the correct app-key. DropBox recommends the real app-key not to public.

 

After

Auth.startOAuth2Authentication(this, "4534hkzhxc8hj" - is not the real app-key

the redirect Url

db-4534erter45646://1/connect?oauth_token=oauth2:&oauth_token_secret=sl.BE4JfDiYMLV2GSkHe-f-TkpxD1-n0EcIIqBbPhQGH5ACISVsMB_AUznLC1weqvQWqsgQEAMgiWQmtXmbGZQ4Wfg2QvbBl1qVImRkJECSWV8sbxharzhk50b9jUfbOsPF_VseA9wgj45R&uid=422345066&state=oauth2%3Ae803b8143706e7ecd2603b2213e1c5a7&expires_in=14400

 

I tried to generate an Access Token with

 

private void getAccessToken() {
String accessToken = Auth.getOAuth2Token();
if (accessToken != null) {
SharedPreferences prefs = getSharedPreferences(App_User.userName, Context.MODE_PRIVATE);
prefs.edit().putString("access-token", accessToken).apply();}

The return is always null, because the redirect URL (s. above) to the app from DropBox is not valid.

schrettinger
Explorer | Level 3
Go to solution

Hello,

 

no answer helped me. Nobody told me what's the reason for the invalid URL.

Greg-DB
Dropbox Staff
Go to solution

@schrettinger I understand you're attempting to integrate with the Dropbox API in your Android app. To do so, please make sure you're following the instructions here exactly:

 

https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/DropboxAndroid

 

That will guide you through using the right methods and setting your app key correctly.

Need more support?