Twitter.getSessionManager() is null / using fabric-generated ios token



Hi, I want to implement Twitter auth in my app, but Twitter.getSessionManager() returns null.

I tried following code.

in Application class

  TwitterAuthConfig config = new TwitterAuthConfig(CONSUMER_KEY, CONSUMER_SECRET);
  // we've used the same CONSUMER_KEY and CONSUMER_SECRET for digits and it worked fine.
  // This time, I added 'new Twitter(config)' to implement twitter authentication.
  Fabric.with(this, new Crashlytics(), new Twitter(config), new TwitterCore(config), new Digits());

In Activity class

  if (Twitter.getSessionManager().getActiveSession() == null) {
    new TwitterAuthClient().authorize(getActivity(), callback);

then I get NullPointerException because Twitter.getSessionManager() is null.
Official document doesn’t say it can return null. Is this expected behaviour?

One possible cause that I can think is that, we’re using CONSUMER_KEY/CONSUMER_SECRET generated by Fabric tool for ios app. We do so because we couldn’t figure out the way to “share” contact information among ios app and android app.

If this is the case, how can app enable app authentication for existing token, or use different token for auth and digits?

I already saw following threads, but didn’t find solution for my case.


@daisy1754 My apologies for the severe delay in getting back to you on this. Could you share package name of your app so that I can look into your key configuration on our end?