jaliss / securesocial

A module that provides OAuth, OAuth2 and OpenID authentication for Play Framework applications
http://www.securesocial.ws
Apache License 2.0
1.19k stars 510 forks source link

securesocial - Could not find an appropriate constructor to instantiate plugin #445

Closed raichuAK closed 9 years ago

raichuAK commented 10 years ago

Using Play 2.3.1, Java, Scala 2.10.0

I am trying to integrate securesocial in my web project

/build.sbt

lazy val root = project.in( file(".") ).enablePlugins(PlayJava) scalaVersion := "2.11.1"

libraryDependencies ++= Seq( jdbc, cache, filters, anorm, "com.typesafe.play.plugins" %% "play-plugins-util" % "2.3.0", "com.typesafe.play.plugins" %% "play-plugins-mailer" % "2.3.0", "org.mindrot" % "jbcrypt" % "0.3m", "ws.securesocial" %% "securesocial" % "master-SNAPSHOT" )

resolvers += Resolver.sonatypeRepo("snapshots")

conf/play.plugins

1500:com.typesafe.plugin.CommonsMailerPlugin 10001:securesocial.core.providers.FacebookProvider

conf/securesocial.conf

securesocial { onLoginGoTo=/ onLogoutGoTo=/login ssl=false
assetsController=controllers.ReverseMyCustomAssetsController

userpass {      
    withUserNameSupport=false
    sendWelcomeEmail=true
    enableGravatarSupport=true
    signupSkipLogin=true
    tokenDuration=60
    tokenDeleteInterval=5
    minimumPasswordLength=8
    enableTokenJob=true
    hasher=bcrypt
}
twitter {
    requestTokenUrl="https://twitter.com/oauth/request_token"
    accessTokenUrl="https://twitter.com/oauth/access_token"
    authorizationUrl="https://twitter.com/oauth/authenticate"
    consumerKey=your_consumer_key
    consumerSecret=your_consumer_secret
}

facebook {
    authorizationUrl="https://graph.facebook.com/oauth/authorize"
    accessTokenUrl="https://graph.facebook.com/oauth/access_token"
    clientId=your_client_id
    clientSecret=your_client_secret
    # this scope is the minimum SecureSocial requires.  You can add more if required by your app.
    scope=email
}

google {
    authorizationUrl="https://accounts.google.com/o/oauth2/auth"
    accessTokenUrl="https://accounts.google.com/o/oauth2/token"
    clientId=your_client_id
    clientSecret=your_client_secret
    scope="https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"
}

} But getting below error

Could not find an appropriate constructor to instantiate plugin [securesocial.core.providers.FacebookProvider]. All Play plugins must define a constructor that accepts a single argument either of type play.Application for Java plugins or play.api.Application for Scala plugins.

The project compiled successfully.

What I am missing? Any pointer will be useful on how to resolve this issue

rayronvictor commented 10 years ago

I'm getting the same error, except that the plugin is GoogleProvider. SecureSocial: master-SNAPSHOT Play 2.3.1 Scala 2.11

My play.plugins

1500:com.typesafe.plugin.CommonsMailerPlugin
9994:securesocial.core.DefaultAuthenticatorStore
9995:securesocial.core.DefaultIdGenerator
9996:securesocial.core.providers.utils.DefaultPasswordValidator
9997:securesocial.controllers.DefaultTemplatesPlugin
9998:services.MyUserService
9999:securesocial.core.providers.utils.BCryptPasswordHasher
10002:securesocial.core.providers.GoogleProvider
10004:securesocial.core.providers.UsernamePasswordProvider
jang1lee commented 10 years ago

The configuration of plugins are changed since the snapshot supported the play 2.3.0. Most of the plugin configuration has been moved to the RuntimeEnvironment trait. If you need to customise the provider list - if you need to support only certain providers, you have to override the providers value of the RuntimeEnvironment trait. I recommend you to look into the sample codes of the snapshot version.

jaliss commented 9 years ago

This article can also help while the docs are not updated: http://www.filtercode.com/play/play-scala-securesocial.