Dropbox OAuth 2 dynamic return URL

做~自己de王妃 提交于 2019-12-12 04:34:40

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/27263120/dropbox-oauth-2-dynamic-return-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!