Legolas
Legolas

Reputation: 12345

Get access_token in Facebook Connect

I am a little new to Java Playframework and testing out the Facebook authentication.

public static Result fbLogin(){
    String token_code_url = "https://www.facebook.com/dialog/oauth?client_id=MY_APP_ID&redirect_uri=http://localhost:9000/&response_type=token";
    return redirect(token_code_url);
}


public static Result index() {

Result loginResult = fbLogin();
return loginResult;

}

This opens Facebook, and i give access to my app.

it returns with http://localhost:9000/#access_token=ACCESS_TOKEN

How do i get the ACCESS_TOKEN ?

Do I need to configure the routes ? I seem to get a This webpage has a redirect loop on the browser.

Upvotes: 0

Views: 163

Answers (1)

Samuel
Samuel

Reputation: 1667

You seem to use the client-side authentication: The part of the URL after "#" is not sent to the server.

I suggest you use one of the available modules to do the Facebook login, for example, SecureSocial: https://github.com/jaliss/securesocial or Play! Authenticate: http://joscha.github.com/play-authenticate/

Upvotes: 1

Related Questions