Facebook native mobile application and mobile browser sharing session
Asked Answered
L

4

7

I have a website which allows login via facebook functionality and displays photos from facebook.

While accessing from a mobile browser I would like the website to automatically login(when the click on FB login button, without entering username and password) if the user is already logged in via the native FB application (iOS or andriod). It seems to be that I can do that by building a native iOS or android application and use facebook single sign on feature. Is it possible to do that without having the user install anything on their mobile device?

Lasley answered 21/12, 2012 at 19:3 Comment(0)
P
4

That is not possible.

Auto-Login relies on auth tokens that will be granted to a website or mobile app after a user approves an app. For security reasons, those tokens are tight to the cause they were issued for. Particularly, web tokens and mobile tokens are not interchangeable.

So you could build a native mobile app to get a "native token", but even if you would manage to (cookie-)inject it into a browser view, your website's backend couldn't use it.

More generally, you're raising an issue even facebook can't solve: Say you are using a facebook mobile app and logged in there. If you open facebook's web version on that very same phone, you'll have to log in there again. The root cause is the same as with above. Specifically, any native app is uncapable of setting arbitrary auth cookies into the OS browser. I personally believe this restriction will not fall, because it would have a large security impact - just imagine how any app could set (and possibly get) cookies for any website.

Passant answered 8/1, 2013 at 8:22 Comment(0)
Q
2

If they've never logged in facebook from their Mobile, how will your website ever know them ?

Is it possible to do that without having the user install anything on their mobile device?

Like PC's, users in a mobile device need to login in their phone in facebook's website before being eligible to login "automatically" to your website. When I say automatically, I mean they still have to go with the first time process of "Do you authorize this app/website to do X things on your account". That message is inevitable when using facebook's api on the web.

Hope this answers your question.

Quoits answered 1/1, 2013 at 17:42 Comment(0)
H
2

Is it possible to do that without having the user install anything on their mobile device?

No this would not be possible. You need to have a native or hybrid app (phonegapped etc) to make it work. Mobile web apps run in a browser sandbox and without native code interface - you cannot get to the native SSO of FB on your mobile device

Hatbox answered 7/1, 2013 at 11:9 Comment(0)
I
1

Did you have a look at this facebook page ? I'm not sure what you ask is possible, as basav said, but maybe you'll have some clues there.

Incunabulum answered 7/1, 2013 at 15:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.