0

The Dropbox OAuth 2 requires me to set a return URL. Is it possible to implement the OAuth 2 flow with a dynamic return URL?

Background on why I need the return_url to be dynamic: The flow works great if the integration is through a website, however I am working on a product which is managed through a web console, and typically users will access it using the private IP on the unit. This IP is something I cannot know in advance.

Possible Solutions if dynamic return URLs aren't possible:

  1. I host a cloud service of some sort to act as a broker --- the broker is a fixed URL and I relay back the access code to the device.

  2. Use OAuth 1, which doesn't seem to have this restriction.

2
  • 1
    It is not possible. The return_uri parameter in your request must be exactly the same as one registered. You could use the state parameter to do so. Commented Dec 3, 2014 at 12:34
  • Thanks- I have decided to go with OAuth1 right now. However for future, a central broker service is the right path. Commented Dec 4, 2014 at 8:32

1 Answer 1

2

Florent's comment is correct, this isn't currently possible, as all OAuth 2 redirect URIs are required to be pre-registered as a matter of security. I'll be sure to pass this along as feedback though.

As mentioned though, one thing you may be able to do instead is to use one static redirect URI but encode the necessary information in the 'state' parameter, and decode it as necessary after the redirect back to your app, to handle it as necessary:

https://www.dropbox.com/developers/documentation/http/documentation#oauth2-authorize

Alternatively, you can use OAuth 1, which doesn't require pre-registered redirect URIs. Edit: note that OAuth 1 is only available for API v1, which is now deprecated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.