Steam OpenId and Play Framework

I'm having trouble using Steam as an OpenId provider. Everything works fine until a callback is made on my site, I see the password login web page, and I can log in with my user, but when calback is executed, I get an exception. I am using play 2.2 and Scala. The code is very similar to the one found on the game documents

  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)
        }
  }

Stacktrace:

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]

I see this error message in the returned URL openid.error=Invalid+claimed_id+or+identity, but could not find anything related.

What am I missing? Thanks.

+4
source share
1 answer

, OpenID Play Framework 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:

OpenID (OP), . OpenID Authentication " http://specs.openid.net/auth/2.0/identifier_select" , OP-Local Identifier, OP.

, 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.

0

Source: https://habr.com/ru/post/1528959/


All Articles