键入不匹配的简单安全社交游戏2应用程序

时间:2014-04-04 02:59:04

标签: scala playframework playframework-2.2 securesocial

我正在尝试基于this demo基于securesocial示例实现一个非常简单的播放应用。

play 2.2.2 built with Scala 2.10.3 (running Java 1.7.0_45)

但是,我收到compile错误。

编译错误

type mismatch; found : String("/link-result") required: Int
In /Users/ssimanta/demo-play-auth/app/views/index.scala.html at line 60.
57    @Registry.providers.all.values.map { provider =>
58        @if( provider.authMethod == OAuth1 || provider.authMethod == OAuth2 ) {
59            @defining( "securesocial/images/providers/%s.png".format(provider.id) ) { imageUrl =>
60            <a href="@provider.authenticationUrl("/link-result")"> <img src="@RoutesHelper.at(imageUrl)"/></a> 
61        }
62        }
63    }
64    </span>
65    <hr>

2 个答案:

答案 0 :(得分:1)

路径周围的双引号不会被转义。

试试这个:

"""@provider.authenticationUrl("/link-result")"""

或:

"@provider.authenticationUrl('/link-result')"

答案 1 :(得分:0)

我遇到了同样的错误,它与引号无关:我在构建2.1.4文件中引用了2.1.x-SNAPSHOT而不是.sbt。后者SecureSocial版本支持提供者链接,并在module-code/app/securesocial/core/IdentityProvider.scala中定义:

def authenticationUrl(redirectTo: String): String = RoutesHelper.authenticate(id, Some(redirectTo)).url