本文介绍了Twitter oauth_callback 参数被忽略!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 ASP.NET 站点上进行 Twitter 身份验证.当你在 Twitter 网站上创建应用程序时,你必须指定一个回调 URL,为了论证,我已经设置为 http://mydomain.com

I'm trying to get Twitter authentication working on my ASP.NET site. When you create the app on the Twitter website, you have to specify a callback URL, which for sake of argument, I have set to http://mydomain.com

我已阅读 oAuth 1.0a 规范,要使用您自己的自定义回调 URL 覆盖此回调 URL,您必须在 request_token 阶段(当然是 url 编码的)发送 oauth_callback 参数.

I've read the oAuth 1.0a spec, and to override this callback URL with your own custom one you have to send the oauth_callback parameter in the request_token phase (url-encoded of course).

所以我的请求 URL 如下所示:

So my request URL looks like this:

http://twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Fmydomain.com%2Ftwittercallback

据说,如果一切按计划进行,在您的响应数据中,除了您的令牌和令牌秘密参数之外,您还应该收到一个新参数 oauth_callback_confirmed=true.

Supposedly, if all goes to plan, in your response data, you are supposed to receive a new parameter of oauth_callback_confirmed=true in addition to your token and token secret parameters.

但是,我的回答是:oauth_token=MYTOKEN&oauth_token_secret=MYTOKENSECRET

However, my response comes through as:oauth_token=MYTOKEN&oauth_token_secret=MYTOKENSECRET

我知道我没有给你们提供最多的内容,但我不知道为什么我没有收到 oauth_callback_confirmed 参数.如果没有这个,我的应用程序会一直默认返回到 Twitter 网站上硬编码的回调 URL.如果有人可以帮助我,我将永远感激不尽!

I know I haven't given you guys the greatest amount to go on, but I'm at my wits end as to why I am not receiving the oauth_callback_confirmed parameter. Without this, my application keeps defaulting back to the callback URL hard-coded on the Twitter website. Please if anyone could help me out, I will be eternally grateful!

谢谢,A.

推荐答案

我用过 本指南 设置我的 PC 用作回调位置.基本上,您以某种方式设置主机文件,清除缓存并添加几个 Firefox 注册表值.最后,当您调试 oauth 调用时,重定向会返回到您的本地 PC.

I've used this guide to set up my PC to be used as the callback location. Basically you set up your hosts file in a certain way, clear your cache and add a couple of Firefox registry values. At the end when you are debugging an oauth call the redirect comes back to your local PC.

正如我所说,它对我有用.

As I said it worked for me.

这篇关于Twitter oauth_callback 参数被忽略!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 11:18