0

I'm trying to develop a share extension that uses Facebook SDK to post status updates to user's wall.

The problem: user is already logged in on the main app but when I run the share extension target, Facebook access token becomes nil (not authenticated). When I try to request a login from the share extension it opens Facebook app but goes back to the main app - so the current session was lost.

Here's what I tried already:

  • Enable app groups compatibility (both targets belong to same group)
  • Added Facebook required info on share extension's plist file
  • Added the share extension bundle id on Facebook app settings page

Still no luck so far. I am just dropping this to get ideas and suggestions. Maybe other already implemented something like this.

Thanks in advance!

schystz
  • 800
  • 1
  • 8
  • 21
  • Answering my own question... I found one solution where I store FBSDKAccessToken in the NSUserDefaults from the main app. Then, when the extension is presented, it loads the FBSDKAccessToken from NSUserDefaults if there's no logged in user. Thankfully Facebook SDK makes the access token portable! :) – schystz Apr 30 '15 at 07:22
  • `FBSDKAccessToken` @ `NSUserDefaults`? Seems very secure... (not) – Carlos Ricardo Nov 26 '15 at 10:21
  • 1
    I agree with @CarlosRicardo that you might want to store the session token in the encrypted iOS keychain. `NSUserDefaults` are stored in binary format, with no encryption, and is stored in your app’s directory. So anyone with access to the device can easily read that token and potentially misuse it. – Manuel Mar 18 '18 at 20:55

0 Answers0