iOS - Facebook won't authenticate old users (Incorrect value) - ios

We are using Django framework called "AllAuth" to authenticate our users through Facebook and Twitter.
For unknown reason some of our users get "Incorrect value" error when they try to login again in our app. This is not happening for new users.
I manage to troubleshoot it and I noticed that if I change the permissions (eg. added permission for "Location") in iOS SDK or if I delete our app from Facebook Apps I was able to connect successfully. So I guess it has to be something with the token for our old users. Unfortunately I can't reproduce the error now but some of our clients still can't login.
Is there any way to "re-request" user's permission from iOS SDK?
Update:
The error is
The access token is invalid since the user hasn't engaged the app in
longer than 90 days
It's a know issue of Facebook and there is an open ticket for that!

Related

How to allow access to logged in users email message while using Google plus sdk in ios?

I have got Google signin integration for my application. I successfully integrated it and by default i am getting username, usermailid, , user id and user authorization token id from sdk. Next thing i want is how to retrieve messages of Logged in user inbox. I went through the following links
https://developers.google.com/+/web/api/rest/oauth#authorization-scopes
https://developers.google.com/identity/protocols/googlescopes#replicapoolupdaterv1beta1
But still i am getting problems and confused in getting mail messages.
I think this is what you need
https://www.googleapis.com/gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}
And I strongly recommend you to use Google Playground to pick the exact API you are looking for

How to know user has already done Facebook login at iOS app

I am developing iOS App which use Facebook iOS SDK 4.
When user has already done Facebook login, by doing Facebook login the dialog which shows "user has already approved your app" had be displayed.
So, do not show the dialog. I want to know whether the user has already done Facebook login.
Anyone know the good way? I think accessToken is returned if user once had done Facebook login.
FBSDKAccessToken manage current logged user's accessToken.
According to official Facebook Login guide
"FBSDKAccessToken Represents the access token provided by a successful login. Most important, it provides a global +currentAccessToken to represent the currently logged in user."
The currentAccessToken is a convenient representation of the token of the current user and is used by other SDK components (like FBSDKLoginManager).
According to above you can check either user has valid accessToken or not and based on this you can track call login method otherwise just skip to next flow.
In Facebook the access tokens are per user so you can pass them around apps and they will work. In your case if you can ship an access token from another app you will be able to skip the next logging in and use the API normally.
However I think this this thread will help you.
Things are a little bit different with iOS cause I have done a facebook login on Android and got no such issues.

ios - multi facebook account on one device

I'm having an iOS app, need Facebook login to share something to wall. Everything is ok until I received new feedback from customer. Let me describe this case.
Apple have integrated Facebook into iOS system, user just needs to login via Setting, it is so easy for user. But my customer does not want to do that, they want user to login Facebook inside app and use it instead of Facebook of iOS system. Problem is here, there is a case: user has already logged in Facebook account A via iOS system, then user opens app and login Facebook inside app with other Facebook account B. After that, user shares a picture. Requiment is this picture should be shared on wall of Facebook account B (of app), but this picture appeared on wall of Facebook account A(of iOS system).
I just wonder do we have any solutions to resolve this case? Please give me any ideas you all have in mind after reading.
Thanks,
Ryan
I faced the same problem with Facebook SDK whenever a user login from any app using Facebook it change userid returned with the token which leads to share on the latest opened account.
if you open Facebook from a browser you will get this message from Facebook " we got confused please re-login "
so i took the same approach i saved user-id User(A) and whenever user share i check id coming with token if it changed i show " Facebook account changed please relogin " & i log all users out.
check this link may be helpful: https://www.facebook.com/help/community/question/?id=10205949056147843

Facebook Authentication for user with multiple iOS devices (Ruby On Rails and iOS SDK)?

Currently my iOS app facebook atuhtentication does not work for users that have two iOS devices.
It works only when the user has one iOS device. The app uses the iOS SDK. (Not the Facebook SDK)
On the server side I use a rails app. The rails app receives a facebook token from the iOS app, and it uses the token to fetch the user email and profile picture.
#graph = Koala::Facebook::API.new(facebook_token)
profile = #graph.get_object("me")
profile_picture = #graph.get_picture("me")
Koala responds with the following error:
"Koala::Facebook::AuthenticationError: type: OAuthException, code: 190, error_subcode: 460,
message: Error validating access token: Session does not match current stored session. This
may be because the user changed the password since the time the session was created or
Facebook has changed the session for security reasons. [HTTP 400]"
I would like to know how to solve this issue and allow facebook authentication for users with more than one iOS device?
Thanks in advance.
SOLUTION
For this case the solution consited in handling the authenticaiton via the facebook device, instead of via the rails app.
Also it is useful to have a server based facebook authentication cache. Per Facebook documentation recommendation:
https://developers.facebook.com/docs/ios/login-tutorial/#tokencache
SOLUTION
For this case the solution consited in handling the authenticaiton via the facebook device, instead of via the rails app.
Also it is useful to have a server based facebook authentication cache. Per Facebook documentation recommendation:
https://developers.facebook.com/docs/ios/login-tutorial/#tokencache

Facebook AccessToken from iOS doesn't have access to email permission

My app supports Facebook login and will be released to Apple Appstore real soon. I was testing the Facebook login for a while and it seemed to work all the time until now. When I login, the access token return by Facebook does not have email as one of the permission and I do need email for registering with my app. On developer.facebook.com under settings for my app, I have the following setup
User & Friend Permissions: email user_about_me user_birthday
Extended Permissions: read_friendlists
I also got the accessToken from my device and used https://developers.facebook.com/tools/debug/ and pasted my access token in there but it doesn't have email as one of the scope (the only scope listed is user_friends).
The app on Facebook is set to live (non-sandbox) so everyone can access it. Also on iOS, I do not have my app listed under Settings->Privacy->Facebook even after I give my app access to Facebook by successfully signed into Facebook. When I press login with Facebook, it opens Facebook website and says the following "'My App' will receive the following info: your public profile and friend list." and it doesn't mention email in there.
I have removed Facebook app from iOS, logged out of Facebook account from iOS settings, restarted the device and also removed my app and installed again and nothing seems to be working for iOS. We do have an Android version of our app, and that is working (able to get email) without any problem.
Any help is appreciated.
Edited:
Also on Facebook it says that my app accessed email (for my profile) on Oct 25th. So it was able to access email on that day.
However you are requesting the login you have to manually request the e-mail on top of basic permissions. You do so by putting under the readPermissions an array that contains the string email, like so...
fbLoginView.readPermissions = #[#"email"]
Or in openActiveSessionWithReadPermissions:allowLoginUI:completionHandler put the first argument as #[#"email"].
Weirdly, I've found that the app permissions do not often correlate the permissions that the app grabs.

Resources