cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Get summer ready with Dropbox basic - travel documents, plans, progress reminders and more, right over 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: 

Redirect without "Enter this code into" -> redirect not working (JAVA SDK)

Redirect without "Enter this code into" -> redirect not working (JAVA SDK)

vished
Explorer | Level 3

Hi all, 

I have a problem to integrate Dorpbox in my app.
I have entered in the GUI a redirect URL: 

http://localhost:8080/portal/cloudHoster.jsf

I´m generating the url which I´m using to redirect to Dropbox to login / approve:

	public String generateAuthorizeUrl() {

		// Read app info file (contains app key and app secret)
		DbxAppInfo appInfo;
		appInfo = new DbxAppInfo(APP_KEY, APP_SECRET);

		// Run through Dropbox API authorization process
		DbxRequestConfig requestConfig = new DbxRequestConfig("foo");
		DbxWebAuth webAuth = new DbxWebAuth(requestConfig, appInfo);
		
		
		DbxWebAuth.Request webAuthRequest = DbxWebAuth.newRequestBuilder().build();
		
		String authorizeUrl = webAuth.authorize(webAuthRequest);

		return authorizeUrl;
	}

After I approve it, I get again another screen:
Enter this code into MyApp to finish the process.

How can I avoid this? I would like to redirect directly again to my page?

Thank you for your help

 

1 Accepted Solution

Accepted Solutions

Re: Redirect without "Enter this code into" -> redirect not working (JAVA SDK)

Greg-DB
Dropboxer

Yes, that's correct. 

I recommend reading the OAuth Guide for a high-level reference of how this works.

The web-file-browser example app can show it working in an actual app you can run locally.

View solution in original post

5 Replies 5

Re: Redirect without "Enter this code into" -> redirect not working (JAVA SDK)

Greg-DB
Dropboxer

In addition to registering the redirect URI in the App Console like you mentioned, you should set the redirect URI you want to use in the code like DbxWebAuth.newRequestBuilder().withRedirectUri(...).build(). There's an example here.

Re: Redirect without "Enter this code into" -> redirect not working (JAVA SDK)

vished
Explorer | Level 3

Thank you, but should this be looking like with the 

HttpServletRequest request, HttpServletResponse response ?

How should my class looks like? And also my function?

Re: Redirect without "Enter this code into" -> redirect not working (JAVA SDK)

Greg-DB
Dropboxer

Exactly how your web request/response handling code will look and work will depend on what web framework you're using, so you'll need to write the relevant code for your app.

I recommend trying out the working web app example for a sample of how this would work though. The instructions for running the examples can be found here.

Re: Redirect without "Enter this code into" -> redirect not working (JAVA SDK)

vished
Explorer | Level 3

Not sure how this will be implemented.

I have a simple HTML Button "Authenticate Dropbox".

This Button will be redirect to Dropbox, User will accept, and afterwards I got token and user will be redirect to my page...

Re: Redirect without "Enter this code into" -> redirect not working (JAVA SDK)

Greg-DB
Dropboxer

Yes, that's correct. 

I recommend reading the OAuth Guide for a high-level reference of how this works.

The web-file-browser example app can show it working in an actual app you can run locally.

Poll
Which Dropbox Plan do you have?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    vished Explorer | Level 3
What do Dropbox user levels mean?
Need more support?