OAuth流程是:
对于OAuth身份验证,应用程序(也称为OAuth客户端)会将用户重定向到
authorize_url
这会将用户重定向到oauth服务器的网络服务器,用户可以在其中授予网络应用访问他/她的帐户的权限
OAuth服务器将用户重定向到应用程序(也称为oauth客户端)提供的回调URL.此时,回调来自OAuth服务器,因此没有会话ID或会话哈希.应用程序如何确定调用post-oauth回调的用户?
我虽然这样做的方式是:
将用户重定向到authorize_url您将某些参数附加到查询字符串时?id=xxx
当OAuth服务器重定向到客户端提供的callback_url时,带有HTTP消息的参数之一将是在步骤1中附加到查询字符串的参数.
但是,这似乎不适用于我试图加入的OAuth服务器.
有什么建议?
“这不起作用”是什么意思?
服务器没有发回查询部分?您必须对提供给 oauth 服务器的回调 URL 中的状态进行编码。这可以在查询或路径部分中完成。我看不出为什么这不起作用?
也许您假设您有一个可以自动扩展状态的通用回调?据了解,情况并非如此。
编辑
我重新阅读了 Google 实施中的文档:
You can specify a value for oauth_callback in an OAuthGetRequestToken request,
to determine where Google redirects the user after they authorize your access
request. The callback URL can include query parameters. The redirect will include
the same query parameters, as well as the authorized request token, which your
application must be able to parse.
For example, when supporting multiple languages, you can include
a query parameter that identifies the version of the application that a user is
viewing. An oauth_callback value of "http://www.yoursite.com/Retrievetoken?Lang=de"
would result in the redirect
"http://www.yoursite.com/Retrievetoken?Lang=de&oauth_token=DQAADKEDE".
Parsing the token and the language parameter ensures that the user is
redirected back to the correct version of the site.
Run Code Online (Sandbox Code Playgroud)
所以(与我上面的陈述相矛盾)OAuth 服务器主动将信息 (&oauth_token=kkk) 附加到您的 URL。该令牌应与您从“OAuthGetRequestTOken”收到的结果相同。这对你不起作用吗?
据我现在了解,服务器应该从字面上复制您在callback_url中拥有的所有内容,并添加您从服务调用中收到的令牌
您是否有OAuth 服务器到底调用了什么的日志?服务提供商是谁?我无法想象他会缺少这个功能......
| 归档时间: |
|
| 查看次数: |
4535 次 |
| 最近记录: |