我正在尝试创建一个与 SurveyMonkey API 交互的基于 Java 的本地客户端。
SurveyMonkey 需要使用 OAuth 2.0 的长期访问令牌,我对此不太熟悉。
我已经在谷歌上搜索了几个小时,我认为答案是否定的,但我只是想确定一下:
我是否可以编写一个与 SurveyMonkey 交互的简单 Java 客户端,无需在某些云中设置我自己的重定向服务器?
我觉得必须拥有自己的在线服务才能接收 OAuth 2.0 生成的不记名令牌。我是否有可能无法让 SurveyMonkey 直接向我的客户发送不记名令牌?
如果我要在某处设置我自己的自定义 Servlet,并将其用作redirect_uri,那么正确的流程将如下所示:
- Java 客户端从 SurveyMonkey 请求不记名令牌,其中
redirect_uri 是我自己的自定义 servlet URL。
- SurveyMonkey 将令牌发送到我的自定义 servlet URL。
- Java 客户端轮询自定义 servlet URL 直到令牌可用?
它是否正确?
Yes, it is possible to use OAuth2 without a callback URL.
The RFC6749 https://www.rfc-editor.org/rfc/rfc6749 introduces several flows. The Implicit https://www.rfc-editor.org/rfc/rfc6749#section-4.2 (now deprecated[1]) and Authorization Code https://www.rfc-editor.org/rfc/rfc6749#section-4.1 grant types require a redirect URI. However the Resource Owner Password Credentials https://www.rfc-editor.org/rfc/rfc6749#section-4.3 (deprecated as well[1]) grant type does not.
自 RFC6749 以来,还发布了其他规范do not需要任何重定向 URI:
-
RFC7522 https://www.rfc-editor.org/rfc/rfc7522:OAuth 2.0 客户端身份验证和授权授予的安全断言标记语言 (SAML) 2.0 配置文件
-
RFC7523 https://www.rfc-editor.org/rfc/rfc7523:用于 OAuth 2.0 客户端身份验证和授权授予的 JSON Web 令牌 (JWT) 配置文件
-
RFC8628 https://datatracker.ietf.org/doc/html/rfc8628:OAuth 2.0 设备授权授予
- Kerberos 授予类型:参见https://is.docs.wso2.com/en/5.9.0/learn/kerberos-grant/ https://is.docs.wso2.com/en/5.9.0/learn/kerberos-grant/
此外,使用 OpenID Connect,响应模式不一定是重定向到redirect_uri
参数,但可以是对该端点的 POST 请求。请参阅OAuth 2.0 表单后响应模式 https://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html规格以了解更多详细信息。
无论如何,如果上述资助类型不能满足您的需求,没有什么可以阻止您创建一个自定义资助类型 https://www.rfc-editor.org/rfc/rfc6749#section-4.5.
[1]: OAuth 2.1 规范(草案 07) https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-07
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)