- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在使用 Steam 作为 OpenId 提供商时遇到问题。一切正常,直到对我的网站进行回调,我看到 Steam 登录网页并且可以使用我的用户登录,但是当回调执行时,我收到异常。我使用 play 2.2 和 Scala。该代码与 play docs 上找到的代码非常相似。
def loginPost = Action.async { implicit request =>
OpenID.redirectURL("http://steamcommunity.com/openid",
routes.Application.openIDCallback.absoluteURL(),
realm = Option("http://mydomain.com/"))
.map(url => Redirect(url))
.recover { case error => Redirect(routes.Application.login) }
}
def openIDCallback = Action.async { implicit request =>
OpenID.verifiedId.map(info => Ok(info.id + "\n" + info.attributes))
.recover {
case error =>
println(error.getMessage()) //prints null
Redirect(routes.Application.login)
}
}
堆栈跟踪:
Internal server error, for (GET) [/steam/login?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=error&openid.error=Invalid+claimed_id+or+identity] ->
play.api.Application$$anon$1: Execution exception[[BAD_RESPONSE$: null]]
at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.1]
at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$12$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:165) [play_2.10.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$12$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:162) [play_2.10.jar:2.2.1]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33) [scala-library-2.10.3.jar:na]
at scala.util.Failure$$anonfun$recover$1.apply(Try.scala:185) [scala-library-2.10.3.jar:na]
Caused by: play.api.libs.openid.Errors$BAD_RESPONSE$: null
at play.api.libs.openid.Errors$BAD_RESPONSE$.<clinit>(OpenIDError.scala) ~[play_2.10.jar:2.2.1]
at play.api.libs.openid.OpenIDClient.verifiedId(OpenID.scala:111) ~[play_2.10.jar:2.2.1]
at play.api.libs.openid.OpenIDClient.verifiedId(OpenID.scala:92) ~[play_2.10.jar:2.2.1]
at controllers.Application$$anonfun$openIDCallback$1.apply(Application.scala:29) ~[classes/:2.2.1]
at controllers.Application$$anonfun$openIDCallback$1.apply(Application.scala:28) ~[classes/:2.2.1]
at play.api.mvc.Action$.invokeBlock(Action.scala:357) ~[play_2.10.jar:2.2.1]
我在返回的 URL 中看到此错误消息 openid.error=Invalid+claimed_id+or+identity
但找不到任何相关内容。
我错过了什么?谢谢。
最佳答案
这是因为 Play Framework OpenID 类未正确生成重定向 URL。从代码中的这一行打印出 url
变量的值:
.map(url => Redirect(url))
它很可能看起来像这样:
https://steamcommunity.com/openid/login?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0
&openid.mode=checkid_setup
&openid.claimed_id=http%3A%2F%2Fsteamcommunity.com%2Fopenid
&openid.identity=http%3A%2F%2Fsteamcommunity.com%2Fopenid
&openid.return_to=http%3A%2F%2Fwww.mydomain.com%2Fsteam%2Flogin
&openid.realm=http%3A%2F%2Fwww.mydomain.com
根据 OpenID 2.0 规范,这是不正确的,特别是 http://openid.net/specs/openid-authentication-2_0.html#discovered_info :
If the end user entered an OpenID Provider (OP) Identifier, there is no Claimed Identifier. For the purposes of making OpenID Authentication requests, the value "http://specs.openid.net/auth/2.0/identifier_select" MUST be used as both the Claimed Identifier and the OP-Local Identifier when an OP Identifier is entered.
基于此,生成的重定向url
变量应该是:
https://steamcommunity.com/openid/login?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0
&openid.mode=checkid_setup
&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select
&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select
&openid.return_to=http%3A%2F%2Fwww.mydomain.com%2Fsteam%2Flogin
&openid.realm=http%3A%2F%2Fwww.mydomain.com
我已经在 Play Framework 问题跟踪器上写了一个问题:
https://github.com/playframework/playframework/issues/3740
同时,作为临时破解/修复,您可以在 url
变量上使用任意数量的字符串替换技术来设置 openid.claimed_id
和 openid.identity
参数设置为正确的 http://specs.openid.net/auth/2.0/identifier_select
值。
关于scala - Steam OpenId 和 Play 框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22041522/
我一直在查看 Steam API 文档,并且有许多服务提供 Steam 网上商店中游戏的信息,但它们似乎都需要游戏的 Steam ID 作为参数。这可以通过用户 ID 来完成,如果给定用户名,API
我正在尝试获取用户游戏统计数据。首先,我正在尝试这样做: http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?
我正在尝试在 Steam 上找到该项目的名称。 这是我目前从 json 数组中得到的 [appid] => 730 [contextid] => 2 [assetid] => 4981322842 [
我正在开发一个使用公共(public) Steam API 来收集一些信息的应用程序。 目前我通过调用GetPlayerAchievements (v0001)检索成就和通话总时长 GetOwnedG
是否可以使用 Steam API 获取 Steam(753) 或 CsGo(730) 完整背包/库存? 我找到了一个 API,我可以在其中获取 Dota2(570) TF2(440) 的完整背包/元素
我正在尝试获取 JSON 格式的买卖订单,例如价格历史记录,但找不到任何信息。有没有办法做到这一点? Buy and Sell orders screenshot 我尝试过: https://stea
我搜索了论坛,找到了获取所有用户游戏的示例模式: http://steamcommunity.com/id//games?tab=all&xml=1 返回所有游戏。但是,如果用户尚未设置 Steam
我一直在阅读论坛并尝试 Steam API,我正在寻找提供所有 Steam 游戏的 API。 我找到了提供所有 SteamApps 的 API,以及提供应用程序信息的 Steam 商店 API(我正在
Steam 为我们提供了交易相关的API,但没有具体的地址示例:https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService#
Steam 为我们提供了交易相关的API,但没有具体的地址示例:https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService#
我正在尝试使用 Google 日历跟踪我的游戏时间/历史记录。 这是 Steam Web API在其中我找不到一种方法来获取关于我究竟在什么时候玩什么的详细信息,除了 GetRecentlyPlaye
如何使用 Steam API(已启动并运行)获取我的应用程序中当前使用(登录)帐户的 Steam 用户名。 Steam ID 可以(例如)通过以下方式获得: CSteamID id = SteamUs
有很多网站,例如www.tf2outpost.com和 www.bazaar.tf用户可以通过单击按钮添加其他 Steam 用户。你到底是如何做到这一点的? Web API 中没有任何内容向您展示如何
我使用此 URL 在 CS:GO 容器中一次获取 100 个结果。我用 {currency} 代替 3,用 {start} 代替 100 的倍数,我的问题是 currency=3 code> 似乎不是
我在 Steam API 中搜索发送 Steam 报价的方法,但找不到。可以使用 API 或者您知道其他方法吗?我想在 PHP/Symfony 中使用它。 最佳答案 您目前无法通过 API 创建交易报
我想知道有没有办法让用户输入他们的“Steam 用户名”,然后您就可以找到他们的“SteamID”。我一直在查看“Steam API”,但没有找到任何相关信息。 我的想法是让用户将他们的“Steam
是否有 API 可以获取用户的 Steam 集换式卡牌? 我对steam不太熟悉,但这个页面上好像没有。 https://developer.valvesoftware.com/wiki/Steam_
steam 桌面快捷方式 steam:// 实际如何工作? 它们的 URL/目标类似于:“steam://rungameid/717”我知道类似的东西,比如“ftp://mynetworkadress
是否有 API 可以获取用户的 Steam 集换式卡牌? 我对steam不是很熟悉,但是这个页面好像没有。 https://developer.valvesoftware.com/wiki/Steam
steam 桌面快捷方式 steam:// 实际如何工作? 它们的 URL/目标类似于:“steam://rungameid/717”我知道类似的东西,比如“ftp://mynetworkadress
我是一名优秀的程序员,十分优秀!