Dropbox OAuth 2动态返回URL [英] Dropbox OAuth 2 dynamic return URL

查看:80
本文介绍了Dropbox OAuth 2动态返回URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dropbox OAuth 2需要我设置返回网址。可以使用动态返回URL来实现OAuth 2流吗?

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?

为什么我需要return_url是动态的背景:如果集成通过一个网站,但是我正在开发一种通过Web控制台管理的产品,通常用户会使用设备上的专用IP访问它。我事先不知道该IP。

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.

不可能使用动态返回URL的可能解决方案:

Possible Solutions if dynamic return URLs aren't possible:


  1. 我托管某种形式的云服务以充当代理-代理是固定的URL,我将访问代码中继回该设备。

  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.

使用似乎没有此限制的OAuth 1。

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


推荐答案

Florent的评论是正确的,当前是不可能的,因为出于安全考虑,所有OAuth 2重定向URI都必须预先注册。

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.

如上所述,您可能可以做的一件事是使用一个静态重定向URI进行编码'state'参数中的必要信息,并在重定向回您的应用程序后根据需要对其进行解码,以根据需要进行处理:

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

或者,您可以使用OAuth 1,它不需要预先注册的重定向URI。编辑:请注意,OAuth 1仅适用于API v1,现已已弃用

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

这篇关于Dropbox OAuth 2动态返回URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆