Cannot log in with new version 3.0 for facebook sdk for Android

I see there a new version of the Facebook SDK (3.0), which depreciates the old Facebook class and introduces a new way to log in using the Session class.

I quickly wrote a simple application using the new login API:

public class MainActivity extends Activity { private Session mFacebookSession; private StatusCallback fbStatusCallback = new StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { Log.v("dbg", "state: " + state); Log.v("dbg", "session: " + session); } }; public void bc(View view) { mFacebookSession = Session.openActiveSession(this, true, fbStatusCallback); } //etc.. } 

The callback must be called twice, first to destroy the actual session token, and the second to obtain a new access token. Of course, my application id is set as metadata in my manifest file, etc.

When I run the code, the Facebook login dialog appears, I enter my username and password, and then it closes.

However, in my journal I see only this:

 01-17 03:28:01.587: V/dbg(7002): state: OPENING 01-17 03:28:01.587: V/dbg(7002): session: {Session state:OPENING, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[]}, appId:xxxxxxxxxxxxxxx} 

As a result, if I try to call mFacebookSession.getAccessToken (), I get an empty string (but not null).

What is the problem?

HOW I SOLVED THIS (LATER)

I overridden onActivityResult and called Session.getActiveSession (). onActivityResult (this, requestCode, resultCode, data);

+7
source share
2 answers

I'm just going to put this here for someone else:

The SDK for Facebook is really terrible, making it clear that you forgot something. If it doesnโ€™t work for you, double check your Facebook app and make sure you havenโ€™t forgotten anything or entered incorrect values. In my case, the application was incorrect in the case of Sterpa Mihai, it was a hash key

+1
source

another thing that will cause the same error (Token_removed)

Android Facebook SDK3.0 OPEN Session Status

0
source

All Articles