Open lyonsrob opened 9 years ago
Anyone have thoughts on this??
There should be no need to use local storage at all. Session is automatically saved in webview after the first time the user accepts the login. So after logging in for the first time, when you totally close the app and reopen, calling FB.getLoginStatus() should always return connected and calling any of the methods should work.
That's what I would think as well. I seem to be getting intermittent results and can only hold a session for one close/restart cycle.
I'm on ios8 and using Appgyver's Facebook plugin that wraps getLoginStatus in a promise. I'm still investigating whether this is the culprit, though I have not been able to use the FacebookConnectPlugin code by itself either.
Just confirmed, using Wizcorp plugin and the functions found in the example, I am only able to retain session information after one close/reopen cycle.
https://github.com/Wizcorp/phonegap-facebook-plugin/blob/master/platforms/ios/www/index.html
When you say "Saved in the WebView", what happens on the native side? Isn't the WebView reinitiated both in Cordova and AppGyver? What is the safe place where the information is stored/retrieved from?
Sorry maybe my wording is not correct. It's saved but where, not sure. The state will be maintained till you uninstall and reinstall the app again. Also make sure you have "Single Sign-on" in facebook app settings turned on and I think the app also has to be live (not in Sandbox) but I'm not exactly sure about this point. Third for Android, make sure "Key Hash" is entered and is actually correct.
Thanks Guys.
I don't believe it's a Facebook setup issue as I can successfully interact with the FB API. Also, the Wizcorp HelloCordova app works as intended.
@harsaharsa
I only say webview because that's the only difference I can see between Wizcord Cordova app and our steroids app.
On Wednesday, April 22, 2015, butlimous <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:
Sorry maybe my wording is not correct. It's saved but where, not sure. The state will be maintained till you uninstall and reinstall the app again. Also make sure you have "Single Sign-on" turned on and I think the app also has to be live (not in Sandbox) but I'm not exactly sure about this. Third for Android, make sure "Key Hash" is entered and is actually correct.
— Reply to this email directly or view it on GitHub https://github.com/Wizcorp/phonegap-facebook-plugin/issues/977#issuecomment-95153120 .
I have the same issue on iOS.
I use getLoginStatus to see if user is connected or if to show the "login" button. After closing the app (home-double-click & swipe), getLoginStatus returns a disconnected state.
I am using a development profile and development FB app.
Important to note that on Android this works fine (I can even turn off/on device and getLoginStatus still returns connected).
Hi Yaron -
What version are you building on? The team fixed this in the latest stable build.
On Mon, Jul 6, 2015 at 10:40 AM, Yaron Tadmor notifications@github.com wrote:
I have the same issue on iOS.
I use getLoginStatus to see if user is connected or if to show the "login" button. After closing the app (home-double-click & swipe), getLoginStatus returns a disconnected state.
I am using a development profile and development FB app.
Important to note that on Android this works fine (I can even turn off/on device and getLoginStatus still returns connected).
— Reply to this email directly or view it on GitHub https://github.com/Wizcorp/phonegap-facebook-plugin/issues/977#issuecomment-118875592 .
Actually you are right. My bad. getLoginStatus was returning the proper session, and I had a bug. Sorry for firing before looking further :)
Update, it seems that the problem is that cookies are deleted after app stops. So this isn't related to this problem, but still an interesting issue.
@yarontt are you having the cookie deletion issue with AppGyver? Could you create a repro at https://github.com/AppGyver/steroids/issues/951 ?
Not using AppGyver. I'm using PhonegapBuild.
Here's what I'm trying to do, let me know if I'm off base somewhere.
1.) User authenticates with FB plugin and provides app permission 2.) I save the userId in local storage to verify the user has authed on return. 3.) User clicks to "share on facebook" and is prompted for advanced permissions (publish_actions) and I saved the accessToken in localStorage for later use 4.) The post succeeds 5.) User closes app (double tap home button, swipe app to close) 6.) User reopens app, is recognized by userId in local storage 7.) User trys to share again and plugin fails with:
com.facebook.sdk:InvalidOperationException Trace: -[FBSession reauthorizeWithPermissions:isRead:behavior:defaultAudience:completionH andler:
8.) If I put in a call to FB.login() on app start it works, but user is always redirected to the Facebook app first.
How do I open a new user session without displaying the LoginUI?