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

Scala Sample broken for v3.0-M1 #458

Closed nightrise closed 10 years ago

nightrise commented 10 years ago

Hi guys,

I'm new to SecureSocial and Scala, but it seems like you guys have done a fantastic job building a robust authentication framework for Play.

With that said, I've been trying to use the latest version of SecureSocial (3.0 M1) and have run into some issues with the sample code (which I imagine is pretty much for an older version of SS).

The problem is pretty simple: after successfully authenticating with a third party provider (facebook in this case), I am simply brought back to the login page with the message "You need to log in to access that page.".

The logs seem to indicate that I have authenticated successfully though:

debug] s.c.p.FacebookProvider - [securesocial] authorizationUrl = https://graph.facebook.com/oauth/authorize [debug] s.c.p.FacebookProvider - [securesocial] redirecting to: [https://graph.facebook.com/oauth/authorize?scope=email&client_id=fake-client-id&redirect_uri=http%3A%2F%2Flocalserver.com%3A9000%2Fauth%2Fauthenticate%2Ffacebook&response_type=code&state=9169caba-6962-4e24-a965-1ddac14d71e0] [debug] s.c.p.FacebookProvider - [securesocial] user loggedin using provider facebook = BasicProfile(facebook,facebook-fake-id,Some(John),Some(Doe),Some(John Doe),Some(jdoe@fakeemail.com),Some(https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/v/t1.0-1/c0.0.50.50/p50x50/fake-image_n.jpg),AuthenticationMethod(oauth2),None,Some(OAuth2Info(FAKE_ACCESS_TOKEN,None,Some(fake-facebook-id),None)),None) [debug] a.c.InMemoryUserService - users = Map() [debug] s.c.ProviderController - [securesocial] user completed authentication: provider = facebook, userId: 827903223560, mode = SaveMode(signUp) [info] application - traced signup event for user fake-facebook-id [info] application - current language is GET /auth/authenticate/facebook?code=FAKE-AUTH_CODE&state=9169caba-6962-4e24-a965-1ddac14d71e0 [debug] s.c.SecuredActionBuilder - [securesocial] anonymous user trying to access : '/' [debug] application - using CustomLoginController

Note: I've gone through above and replaced actual data with fake data out of consideration for my privacy :).

Any thoughts on what's going on?

nightrise commented 10 years ago

For the record, this was using Scala 2.10, with Play 2.2.4

jaliss commented 10 years ago

@nightrise thanks for the kind words. I just tested this and worked fine. Are you sure you got the samples from the right branch? https://github.com/jaliss/securesocial/tree/3.0-M1.

nightrise commented 10 years ago

Hi Jaliss, I did get the samples from the right branch. I've figured out the issue though, it was related to specifying the domain in the "cookie" config in securesocial.conf.

Seems like it didn't like me setting the domain to localhost. Thanks for taking the time to respond!