Facebook log in keep redirecting in iOS - ios

I have an Unity application using Facebook SDK for user to link their account. Everything works in Android. But in iOS, the login page keep redirecting to the previous page which asking me to login even I press "Continue".
https://youtu.be/nGs8jiaI24s
I have found that there is a post asking the same question. But the solution does not work for me.
Unity Facebook SDK is keeping on asking me to confirm login every time I login to my game
In my case, FB.IsLoggedIn return false so loginWithReadPermission is still being called and user fall in the loop between login and continue.
Are there any method to solve it, or at least get the error message?

Related

Login Error using facebook-swift-sdk in ios

Im getting a login error every time I try to login to my application using the facebook sdk. So when the user gets to the home page they can choose to login with their facebook credentials. When they hit the facebook login button it brings up the user name and password screen, which they then type in their credentials and press done. Now here's the issue, well since it wasn't happening before, when they hit done facebook returns an error stating "LOGIN FAILED: You can't use facebook to log into this app or website because there's an issue with its implementation of Facebook login". I get this every time I try and login using the facebook sdk.
Im using FBSDKCoreKit, FBSDKLoginKit, FBSDKShareKit 4.41.0 and FacebookCore, FacebookLogin, FacebookShare 0.5.0 and Swift 4.0
EDIT ***.
Does anyone know how I can find the error being returned from the facebook login request. The issue is this error message that is showing is appearing in the facebook application before it returns to my application. SO I cant even see the error that is being returned. I checked the response in Xcode when the debugger continued and there is no error
EDIT 2:(In response to the first comment)
The application was already set up to use the facebook sdk and it was working fine. It just recently stopped working.
EDIT 3:
So I Ended up having to update the sdk to the newest versiom and replace the old apis with the new apis they created. So I changed everything out and here comes another problem. I try and login with an account I just created on facebook and it still gives me the same error. Yet, if I try and login with an account that has been previously logged into the application using facebook. I get a successful response and im able to continue on with the application. So I dont get why that new account isn't able to login? Is it because the account is too new?
I AM getting the same error as you. Facebook login has been working since the app was created. Now when I try and login after updating the Facebook SDK, I get no error only "Something is wrong with the implementation" what's weird is if someone has already logged in through facebook the facebook login works correctly.
This is because you haven't set up your app. go to https://developers.facebook.com -> My Apps -> add your app then follow the steps for login.
That should resolve it!

Unity Facebook SDK - Strange FB.Login() Behavior in iOS App

I'm working on connecting an app to Facebook using the Facebook SDK for Unity. The process seems to be working fine except sometimes if a new user tries to use Facebook to login the FB.Login() doesn't ask them for permission to use their birthday and email.
Im using this call for the login:
FB.Login("email, user_birthday", AuthCallback);
and in the Facebook app dashboard, under permissions I added email and user birthday.
What seems to be happening is the first time the user goes to use the Facebook connect and hasn't ok'd the permissions on the login yet when they sign in a dialog pops up in the Facebook webview as them to authorize my app for "friends list and public profile" they hit ok and then my login process fails because I need access to the birthday and email. If they hit my login button again then the FB.Login() function runs again bringing up a second dialog asking for permission to use email and birthday, after they ok this my own login works fine. The other option is to hit the home button on the device reopen the app hit the Facebook connect button again and this time the authorization dialog has all four options "public profile, friends list, email, and birthday"
I followed the docs at https://developers.facebook.com/docs/unity/ for the connect process so I'm not sure where I went wrong.
Any insight into this would be helpful. Just unsure of where to continue looking I have exhausted most of my debugging avenues but I'm new to the Facebook scene, so it's possible i missed something.
Thanks for any help in advance.
EDIT** I'm using Facebook SDK version 4.2.1 and Unity 4.2.0f4

Permissions dialog in Facebook iOS native app

I'm using Facebook iOS SDK 3.5 to log-in into my app, the following method is invoked:
FBSession openActiveSessionWithReadPermissions
If native iOS login is not enabled and facebook iOS app is installed, the login process will get redirected to the facebook app. The problem is that every single time 'FBSession openActiveSessionWithReadPermissions'is invoked, the facebook app presents the permission dialog to the user, even when the user already authorized the FB app.
The permission list is empty (nil). This problem does not happen if native ios or safari are used to log -in.
Any ideas? Thanks
You can check if the user has successfully logged in by checking for an access token here
Also, you can make sure you aren't popping up a GUI from each call by setting allowLoginUI to false.
+ (BOOL)openActiveSessionWithAllowLoginUI:(BOOL)allowLoginUI;
I've not done any iOS FB stuff myself, but that's what I got from reading the docs.
Also, there seems to be a somewhat related question posted here.

Facebook iOS SDK and Safari based authentication issue

I have used latest FB SKD in my iOS app so users can use facebook account to login. Application open the FB app and comes back to my app perfectly fine. However, in some place in the app, i have to show/pull some people facebook page (safari based using WebView), but even user already used the Facebook account to login into my native ios app, but the page still ask user to login again and when they click login, it shows them the annoying FB username/pass page.
Is there anyway, that the FB safari based page can authenticate the user since it's already logged into my app using FB integration? do i have to include query or something. Please give me details how to solve this problem since i'm new in this..
thanks again for your help...
pic: https://www.dropbox.com/s/rjlptu7ufpcq3vl/fb.png
When the user switches to Facebook app to authenticate, it doesn't create a cookie for your UIWebView which is why it's asking to login again. Have the user authenticate inside the UIWebView without switching to the Facebook app.
What you're talking about also sounds like a similar thing that happens with Facebook dialogs not knowing about the current Facebook session.
If you authenticate your user via Facebook, try saying the Facebook object itself as an instance variable somewhere in memory so you can access it again (a property on a singleton controller, perhaps?).
Spawning dialogs from an authenticated Facebook object appears to let them use the dialog without reauthenticating iff you have a [FBSession activeSession]. So you'd also have to maintain an active FB session. But I'm not sure if this kind of solution will work since you didn't show specific code for how you're doing your web-based FB fetches.
This question might also prove helpful:
Implement Login with Facebook in iOS 5 and 6

Not redirecting to Facebook comments in UIWebView after login

I am adding facebook comments to my iPad application using UIWebView and HTML5 code provided by Facebook.
When the user is not logged in, the application shows the comments and button "Login to Facebook to Post a Comment".
Clicking the button takes me through login process. After the login completes the view is redirected with an empty page with "Login complete" message. It is not redirected back to the comments dialog.
Right now I implemented an ugly workaround. Upon receiving webViewDidFinishLoad event, I look at contents of the page and reload it if the page shows this message. Though, it does not seem a clean way to go.
Why doesn't Facebook redirect me back to original comments page?
I suspect the problem you're having is related to this issue: Facebook authentication in a UIWebView does not redirect back to original page on my site asking for auth
Specifically, the standard Facebook web login process launches a new browser window dialog, and dispatches a message back to the opener to indicate login success for the redirect to occur.
Quoting a passage in the linked SO, "UIWebView doesn't support multiple windows so it can't postMessage back to your original page since it's no longer loaded."
I'm also developing an iPad application, and my solution is similar to yours: i drive the user to "https://m.facebook.com", always, to force him to login first, then in "webViewDidFinishLoad" i inspect the returned url and if it matches:
"https://m.facebook.com/login/checkpoint/"
exactly, that is, the url returned upon a successful login, then i call my own method (with reload or anything i want). At this time, the user is authenticated and has a valid FB session, so, redirections are not necessary anymore.
It's definitely not pretty, and may break as soon as FB changes the way it processes the login dialog, but i too cannot find a way to resolve it any better. Even tried using "FB.Event.subscribe('auth.login', function(response) {});" without success, of course, because the code is never reached.
I think a bug is already submitted to FB, but i don't think it's getting the deserved attention...
I ran into same issue as this question, but after reading some Facebook official documentation, I'll be redesigning to use the Facebook native SDK.
All iOS and Android apps must (effective October 2, 2013) use our SDKs
for iOS and Android for requesting permissions.
Though, I also gather that the "or else" is just a "developer notification"?
Posting this in hopes it will save time for someone using the same approach :)

Resources