Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook authenticator not working #193

Open
hpolkowski opened this issue Aug 23, 2018 · 0 comments
Open

Facebook authenticator not working #193

hpolkowski opened this issue Aug 23, 2018 · 0 comments

Comments

@hpolkowski
Copy link

I came across a problem with Facebook authenticator.

Error log:

[ERROR] from controllers.FacebookAuthController in application-akka.actor.default-dispatcher-11 - Failed to retrieve access token. {"access_token":"EAADn...SUu","token_type":"bearer","expires_in":5183538}
jp.t2v.lab.play2.auth.social.core.AccessTokenRetrievalFailedException: Failed to retrieve access token. {"access_token":"EAADn...SUu","token_type":"bearer","expires_in":5183538}
	at jp.t2v.lab.play2.auth.social.providers.facebook.FacebookAuthenticator.parseAccessTokenResponse(FacebookAuthenticator.scala:68)
	at jp.t2v.lab.play2.auth.social.providers.facebook.FacebookAuthenticator$$anonfun$retrieveAccessToken$1.apply(FacebookAuthenticator.scala:42)
	at jp.t2v.lab.play2.auth.social.providers.facebook.FacebookAuthenticator$$anonfun$retrieveAccessToken$1.apply(FacebookAuthenticator.scala:40)
Caused by: scala.MatchError: List({"access_token":"EAADn...SUu","token_type":"bearer","expires_in":5183538}) (of class scala.collection.immutable.$colon$colon)
	at jp.t2v.lab.play2.auth.social.providers.facebook.FacebookAuthenticator$$anonfun$parseAccessTokenResponse$2.apply(FacebookAuthenticator.scala:59)
	at jp.t2v.lab.play2.auth.social.providers.facebook.FacebookAuthenticator$$anonfun$parseAccessTokenResponse$2.apply(FacebookAuthenticator.scala:58)

The problem is that FacebookAuthenticator.scala:59 is decoding response wrong.

params <- response.body.split("&").toList
key :: value :: Nil = params.split("=").toList
if key == "access_token"

The code above is trying to decode this response body in json format:

{"access_token":"EAADn...SUu","token_type":"bearer","expires_in":5182252}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant