These docs are for v2.0. Click to read the latest docs for v7.0.

OAuth2 based providers

To configure OAuth2 based providers you must use the OAuth2Settings class. This class has the following form:

case class OAuth2Settings(
  authorizationURL: Option[String],
  accessTokenURL: String,
  redirectURL: String,
  clientID: String,
  clientSecret: String,
  scope: Option[String] = None,
  authorizationParams: Map[String, String] = Map(),
  accessTokenParams: Map[String, String] = Map(),
  customProperties: Map[String, String] = Map())
PropertyDescription
authorizationURLThe authorization URL provided by the OAuth provider. This isn't needed when using Silhouette in conjunction with client side authentication frameworks
accessTokenURLThe access token URL provided by the OAuth provider
redirectURLThe redirect URL to the application after a successful authentication on the OAuth provider. The URL can be a relative path which will be resolved against the current request's host
clientIDThe client ID provided by the OAuth provider
clientSecretThe client secret provided by the OAuth provider
scopeThe OAuth2 scope parameter provided by the OAuth provider
authorizationParamsAdditional params to add to the authorization request
accessTokenParamsAdditional params to add to the access token request
customPropertiesA map of custom properties for the different providers

Redirect URL

The redirectURL must point to your action which is responsible for the authentication over your defined providers. So if you define the following route as example:

GET  /authenticate/:provider  @controllers.SocialAuthController.authenticate(provider)

Then your redirectURL must have the following format:

redirectURL="https://your.domain.tld/authenticate/facebook"

Example

clef {
  accessTokenUrl="https://clef.io/api/v1/authorize"
  redirectURL="https://your.domain.tld/authenticate/clef"
  clientId="your.client.id"
  clientSecret="your.client.secret"
}

dropbox {
  authorizationUrl="https://www.dropbox.com/1/oauth2/authorize"
  accessTokenUrl="https://api.dropbox.com/1/oauth2/token"
  redirectURL="https://your.domain.tld/authenticate/dropbox"
  clientId="your.client.id"
  clientSecret="your.client.secret"
}

facebook {
  authorizationUrl="https://graph.facebook.com/oauth/authorize"
  accessTokenUrl="https://graph.facebook.com/oauth/access_token"
  redirectURL="https://your.domain.tld/authenticate/facebook"
  clientId="your.client.id"
  clientSecret="your.client.secret"
  scope=email
}

foursquare {
  authorizationUrl="https://foursquare.com/oauth2/authenticate"
  accessTokenUrl="https://foursquare.com/oauth2/access_token"
  redirectURL="https://your.domain.tld/authenticate/foursquare"
  clientId="your.client.id"
  clientSecret="your.client.secret"
}

github {
  authorizationUrl="https://github.com/login/oauth/authorize"
  accessTokenUrl="https://github.com/login/oauth/access_token"
  redirectURL="https://your.domain.tld/authenticate/github"
  clientId="your.client.id"
  clientSecret="your.client.secret"
}

google {
  authorizationUrl="https://accounts.google.com/o/oauth2/auth"
  accessTokenUrl="https://accounts.google.com/o/oauth2/token"
  redirectURL="https://your.domain.tld/authenticate/google"
  clientId="your.client.id"
  clientSecret="your.client.secret"
  scope="profile email"
}

instagram {
  authorizationUrl="https://api.instagram.com/oauth/authorize"
  accessTokenUrl="https://api.instagram.com/oauth/access_token"
  redirectURL="https://your.domain.tld/authenticate/instagram"
  clientId="your.client.id"
  clientSecret="your.client.secret"
}

linkedin {
  authorizationUrl="https://www.linkedin.com/uas/oauth2/authorization"
  accessTokenUrl="https://www.linkedin.com/uas/oauth2/accessToken"
  redirectURL="https://your.domain.tld/authenticate/linkedin"
  clientId="your.client.id"
  clientSecret="your.client.secret"
}

vk {
  authorizationUrl="http://oauth.vk.com/authorize"
  accessTokenUrl="https://oauth.vk.com/access_token"
  redirectURL="https://your.domain.tld/authenticate/vk"
  clientId="your.client.id"
  clientSecret="your.client.secret"
  scope="email"
}

To get the clientId/clientSecret keys you need to log into the developer site of each service and register your application.