{"action":"created","issue":{"url":"https://api.github.com/repos/mohiva/play-silhouette/issues/464","repository_url":"https://api.github.com/repos/mohiva/play-silhouette","labels_url":"https://api.github.com/repos/mohiva/play-silhouette/issues/464/labels{/name}","comments_url":"https://api.github.com/repos/mohiva/play-silhouette/issues/464/comments","events_url":"https://api.github.com/repos/mohiva/play-silhouette/issues/464/events","html_url":"https://github.com/mohiva/play-silhouette/issues/464","id":146855501,"number":464,"title":"Shouldn't use hard code response_type for Facebook API","user":{"login":"viennv1709","id":5088270,"avatar_url":"https://avatars.githubusercontent.com/u/5088270?v=3","gravatar_id":"","url":"https://api.github.com/users/viennv1709","html_url":"https://github.com/viennv1709","followers_url":"https://api.github.com/users/viennv1709/followers","following_url":"https://api.github.com/users/viennv1709/following{/other_user}","gists_url":"https://api.github.com/users/viennv1709/gists{/gist_id}","starred_url":"https://api.github.com/users/viennv1709/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viennv1709/subscriptions","organizations_url":"https://api.github.com/users/viennv1709/orgs","repos_url":"https://api.github.com/users/viennv1709/repos","events_url":"https://api.github.com/users/viennv1709/events{/privacy}","received_events_url":"https://api.github.com/users/viennv1709/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-08T08:23:38Z","updated_at":"2016-04-09T07:29:04Z","closed_at":null,"body":"This is a problem when using Facebook API version 2.5.\r\nIn version 2.5 response_type=\"token\" (not response_type=\"code\" as in version 2.3)\r\n\r\n```scala\r\ndef authenticate[B]()(implicit request: ExtractableRequest[B]): Future[Either[Result, OAuth2Info]] = {\r\n    request.extractString(Error).map {\r\n      case e @ AccessDenied => new AccessDeniedException(AuthorizationError.format(id, e))\r\n      case e => new UnexpectedResponseException(AuthorizationError.format(id, e))\r\n    } match {\r\n      case Some(throwable) => Future.failed(throwable)\r\n      case None => request.extractString(Code) match {\r\n        // We're being redirected back from the authorization server with the access code\r\n        case Some(code) => stateProvider.validate.flatMap { state =>\r\n          getAccessToken(code).map(oauth2Info => Right(oauth2Info))\r\n        }\r\n        // There's no code in the request, this is the first step in the OAuth flow\r\n        case None => stateProvider.build.map { state =>\r\n          val serializedState = state.serialize\r\n          val stateParam = if (serializedState.isEmpty) List() else List(State -> serializedState)\r\n          val params = settings.scope.foldLeft(List(\r\n            (ClientID, settings.clientID),\r\n            (RedirectURI, resolveCallbackURL(settings.redirectURL)),\r\n            (ResponseType, Code)) ++ stateParam ++ settings.authorizationParams.toList) {\r\n            case (p, s) => (Scope, s) :: p\r\n          }\r\n          val encodedParams = params.map { p => encode(p._1, \"UTF-8\") + \"=\" + encode(p._2, \"UTF-8\") }\r\n          val url = settings.authorizationURL.getOrElse {\r\n            throw new ConfigurationException(AuthorizationURLUndefined.format(id))\r\n          } + encodedParams.mkString(\"?\", \"&\", \"\")\r\n          val redirect = stateProvider.publish(Results.Redirect(url), state)\r\n          logger.debug(\"[Silhouette][%s] Use authorization URL: %s\".format(id, settings.authorizationURL))\r\n          logger.debug(\"[Silhouette][%s] Redirecting to: %s\".format(id, url))\r\n          Left(redirect)\r\n        }\r\n      }\r\n    }\r\n  }\r\n```\r\n\r\n```scala\r\nobject OAuth2Provider {\r\n\r\n  /**\r\n   * The error messages.\r\n   */\r\n  val AuthorizationURLUndefined = \"[Silhouette][%s] Authorization URL is undefined\"\r\n  val AuthorizationError = \"[Silhouette][%s] Authorization server returned error: %s\"\r\n  val InvalidInfoFormat = \"[Silhouette][%s] Cannot build OAuth2Info because of invalid response format: %s\"\r\n\r\n  /**\r\n   * The OAuth2 constants.\r\n   */\r\n  val ClientID = \"client_id\"\r\n  val ClientSecret = \"client_secret\"\r\n  val RedirectURI = \"redirect_uri\"\r\n  val Scope = \"scope\"\r\n  val ResponseType = \"response_type\"\r\n  val State = \"state\"\r\n  val GrantType = \"grant_type\"\r\n  val AuthorizationCode = \"authorization_code\"\r\n  val AccessToken = \"access_token\"\r\n  val Error = \"error\"\r\n  val Code = \"code\"\r\n  val TokenType = \"token_type\"\r\n  val ExpiresIn = \"expires_in\"\r\n  val Expires = \"expires\"\r\n  val RefreshToken = \"refresh_token\"\r\n  val AccessDenied = \"access_denied\"\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/mohiva/play-silhouette/issues/comments/207733780","html_url":"https://github.com/mohiva/play-silhouette/issues/464#issuecomment-207733780","issue_url":"https://api.github.com/repos/mohiva/play-silhouette/issues/464","id":207733780,"user":{"login":"viennv1709","id":5088270,"avatar_url":"https://avatars.githubusercontent.com/u/5088270?v=3","gravatar_id":"","url":"https://api.github.com/users/viennv1709","html_url":"https://github.com/viennv1709","followers_url":"https://api.github.com/users/viennv1709/followers","following_url":"https://api.github.com/users/viennv1709/following{/other_user}","gists_url":"https://api.github.com/users/viennv1709/gists{/gist_id}","starred_url":"https://api.github.com/users/viennv1709/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viennv1709/subscriptions","organizations_url":"https://api.github.com/users/viennv1709/orgs","repos_url":"https://api.github.com/users/viennv1709/repos","events_url":"https://api.github.com/users/viennv1709/events{/privacy}","received_events_url":"https://api.github.com/users/viennv1709/received_events","type":"User","site_admin":false},"created_at":"2016-04-09T07:29:04Z","updated_at":"2016-04-09T07:29:04Z","body":"I'm a newbie in play-silhouette. But in use I found some problems in version 3.0. I think that overriding a provider is possible but not recommanded. You can create a response params object for facebook or google, so on in the config file and then load that config in use instead. "}}