401 尝试从 Windows Live 获取访问令牌时 (ColdFusion)

发布于 2024-11-09 04:44:42 字数 1655 浏览 0 评论 0原文

我正在尝试遵循微软提供的获取访问令牌的示例: http://msdn.microsoft.com/en-us/library/ff750952.aspx

我的代码如下所示:

<cfset ACCESS_TOKEN_URL = "https://consent.live.com/AccessToken.aspx" />

<cfset clientID = "0000000048052422" />
<cfset secretKey = "9MzM2FgYMHDg2TF9165PaU548ix4efVg" />
<cfset callbackURL = "http://sportsbuzz.local/" />

<cfhttp method="post" url="#ACCESS_TOKEN_URL#" result="liveResult">
    <cfhttpparam type="url" name="wrap_client_id" value="#clientID#" />
    <cfhttpparam type="url" name="wrap_client_secret" value="#secretKey#" />
    <cfhttpparam type="url" name="wrap_callback" value="#callbackURL#" />
    <cfhttpparam type="url" name="wrap_verification_code" value="#url.wrap_verification_code#" />
    <cfhttpparam type="url" name="idtype" value="CID" />
</cfhttp>

<cfdump var="#liveresult#">

但我收到 401 错误,响应如下:

文件内容 401 - 未经授权:由于凭据无效,访问被拒绝。

服务器错误

401 - 未经授权:由于凭据无效,访问被拒绝。

您无权使用您提供的凭据查看此目录或页面。

Header HTTP/1.1 401 Unauthorized Expires: -1 Date: Tue, 24 May 2011 20:11:52 GMT Server: Microsoft-IIS/7.5 Content-Length: 1293 Pragma: no-cache Cache-Control: no-cache Set-Cookie: mktstate=S=948418761&U=&E=&P=&B=; domain=.live.com; path=/ Set-Cookie: mkt1=norm=; domain=.live.com; path=/ Set-Cookie: mkt2=ui=en-us; domain=.consent.live.com; path=/ WWW-Authenticate: WRAP X-AspNet-Version: 2.0.50727 PPServer: PPV: 30 H: BAYIDSTOOL1B09 V: 0 Content-Type: text/html

我不明白我哪里错了。有什么建议吗?

I'm trying to follow this example that microsoft gives for Acquiring an Access Token:
http://msdn.microsoft.com/en-us/library/ff750952.aspx

My code looks like this:

<cfset ACCESS_TOKEN_URL = "https://consent.live.com/AccessToken.aspx" />

<cfset clientID = "0000000048052422" />
<cfset secretKey = "9MzM2FgYMHDg2TF9165PaU548ix4efVg" />
<cfset callbackURL = "http://sportsbuzz.local/" />

<cfhttp method="post" url="#ACCESS_TOKEN_URL#" result="liveResult">
    <cfhttpparam type="url" name="wrap_client_id" value="#clientID#" />
    <cfhttpparam type="url" name="wrap_client_secret" value="#secretKey#" />
    <cfhttpparam type="url" name="wrap_callback" value="#callbackURL#" />
    <cfhttpparam type="url" name="wrap_verification_code" value="#url.wrap_verification_code#" />
    <cfhttpparam type="url" name="idtype" value="CID" />
</cfhttp>

<cfdump var="#liveresult#">

But I am getting 401 errors with the following response:

Filecontent 401 - Unauthorized: Access is denied due to invalid credentials.

Server Error

401 - Unauthorized: Access is denied due to invalid credentials.

You do not have permission to view this directory or page using the credentials that you supplied.

Header HTTP/1.1 401 Unauthorized Expires: -1 Date: Tue, 24 May 2011 20:11:52 GMT Server: Microsoft-IIS/7.5 Content-Length: 1293 Pragma: no-cache Cache-Control: no-cache Set-Cookie: mktstate=S=948418761&U=&E=&P=&B=; domain=.live.com; path=/ Set-Cookie: mkt1=norm=; domain=.live.com; path=/ Set-Cookie: mkt2=ui=en-us; domain=.consent.live.com; path=/ WWW-Authenticate: WRAP X-AspNet-Version: 2.0.50727 PPServer: PPV: 30 H: BAYIDSTOOL1B09 V: 0 Content-Type: text/html

I don't understand where I am going wrong. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对风讲故事 2024-11-16 04:44:42

您是否首先获得了验证码(大多数 OAuth 实现中的请求令牌)?

您需要先获取它才能请求访问令牌: http://msdn .microsoft.com/en-us/library/ff749592.aspx

您正在使用一些 url.wrap_verification_code 变量,但它没有在这段代码中设置。

Did you get the Verification Code (Request Token in most OAuth implementations) first?

You need to get it first in order to ask for Access Token: http://msdn.microsoft.com/en-us/library/ff749592.aspx

You're using some url.wrap_verification_code variable but it's not being set in this bit of code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文