0

I am using the REST-Library Demos to learn how to get & put files to a Dropbox App. I need to set up a redirect_uri but I can't figure out what to provide.

The App setup page says this 'You must provide a proper URI with an authority or path component' and the hint is 'https:// (http allowed for localhost)';

What do I need to provide?

GreatDayDan
  • 169
  • 4
  • 16
  • So why not set the URI to http://localhost:8765 and listen in Delphi on port 8765 for incoming data (i.e. the authorization code)? If you don't specify a redirect_uri the user can always provide the resulting code to your application manually after giving consent. – Rik Nov 15 '17 at 10:23
  • I set a TServerSocket to listen on port 8765. When I ask for an auth-code I get error 400. On the Dropbox side, what should the redirect_URI look like? **"http://localhost:8765"** ? – GreatDayDan Nov 17 '17 at 08:54
  • For Google OAuth2 I encode the redirect_uri (which is `http://localhost:8765` and encodes in `http%3A%2F%2Flocalhost%3A8765`). So result is `&redirect_uri=http%3A%2F%2Flocalhost%3A1500`. I do this with `Params := Params + '&redirect_uri=' + EncodeURLElement(RedirectUri);` – Rik Nov 17 '17 at 09:30
  • BTW. In the above example I have in the third example 1500 at the end. That's because I use port 1500. You can pick any port (>1024) as long as you be consistent about it. – Rik Nov 17 '17 at 10:09

1 Answers1

0

OK, I finally figured what I was doing wrong.

The demo code was adding "LURL := LURL + '&redirect_uri=' + URIEncode('{ANY HTTPS-SITE YOU OWN OR YOU TRUST}');" I changed it to "LURL := LURL + '&redirect_uri=' + URIEncode('http://localhost:8765');" Now the redirect_uri = the app redirect_URI.

GreatDayDan
  • 169
  • 4
  • 16