Prevent LinkedIn from launching mobile app - ios

I'm working on an iOS PhoneGap/Cordova app for a customer that launches a contact's LinkedIn profile page in an in-app browser. (Retrieved the URL from the people api) That part seems to work fine.
The problem is that once the page load, the user's LinkedIn app will launch, kicking the user out of my app.
Does anyone know of a way to prevent this from happening, aside from the user uninstalling their LinkedIn app?

If you are viewing an in-app browser, then you can instead of loading the page, retrieve the html for the page you want to view. Then, if possible, strip out the offending redirection (it might be javascript based) and display the modified HTML. At the end of the day, if you have access to the page that you are displaying, you should be able to find a way to strip out the offending stuff.
Now, if linked in changes their web page, you would probably need to update this code, but this way would work.

Related

iPhone OAuth login request redirects to App not Browser, doesn't work

My current scenario is:
Running an iPhone on the latest iOS
LinkedIn App is installed and logged in
Web browser is NOT logged into LinkedIn (because I have the app)
Developing a web app with "log in with LinkedIn" functionality
On the iPhone, clicking the "log in with LinkedIn" button redirects me straight the the LinkedIn App, which subsequently does nothing - just shows me my feed. I have verified this same behaviour occurs on a third-party site as well as my own. Note that Android exhibits similar behaviour, though I haven't tested as extensively there.
I've found several workarounds:
If I open the web site in Private Browsing mode clicking the login button asks me if I want to open the App or stay in the browser.
If I long-press and "Open in background tab" the login button it'll open (in the background, of course) instead of redirecting to the app, allowing me to log in.
If I manually type "linkedin.com" into the browser and log in then it seems to work too.
None of these are even vaguely practical for end users, essentially forcing us to remove the option entirely.
I'm fairly sure this is a problem at LinkedIn's end and the solution is either:
Don't redirect to the App for OAuth Authorize requests, or
Make the App correctly handle OAuth Authorize requests.
If I'm incorrect and there's some way we can stop this redirect from the client side I'd be happy to hear, otherwise I hope LinkedIn engineers actually see this...
See the comments in Issues with Linkedin Social connection
LinkedIn already confirmed that it is a problem on their side.

Open web page and bypass login from iPhone - iOS

I want to open, from an iOS app, a web page that requires authentication in order to get to that page.
I googled a little bit and I believe I need to use WebKit and Javascript injection, but I am not sure and I have never done something like this, so every bit of information is welcomed or pointing me in the right direction.
I will give an example that I hope will make things more clear(I don't actually want to open facebook, it's just part of the example):
Is it possible to do the following scenario? And if yes, how?
Open a web page from an iOS app, for example: "https://www.facebook.com/profile" without having to go through the login page? I do have the user credentials(username and password), as the user is already logged in with those credentials in the iOS app, but the requirement is to not go through the login page, but to go straight to the profile page.
In general the answer is: no. Even if the user is already logged in and has a valid authentication token that token may only be valid from within your app and not from within the browser. And the login form may be protected by something like a captche preventing you from automatically logging someone in.
There certainly are situation where it is possible: For example if the tokens are not scoped to your app you can try passing them along. Or there is an actual API that you can call with the token that logs the user into the website on the website, etc. But those depend on the specific target website or wether you can control that target website and can add this functionality.

"#sessions" does not exist

I am using https://github.com/arunagw/omniauth-twitter
Apparently this issue only happens on the iPhone and iPad.
Here's how to replicate the issue. I tweeted on Twitter. The tweet contains a link that points to by web app: https://www.foobar.com/1 (ps This is a dummy link. You can use your own link).
Make sure the controller/method handling the link (https://www.foobar.com/1) has the following line redirect_to "/auth/twitter?use_authorize=true"
On the iPhone or iPad, open up the Twitter App. Search for the tweet. Tap on the link (https://www.foobar.com/1).
The page should redirect you back to /auth/twitter?use_authorize=true. Everything works fine so far. The user is sent to Twitter's login portal/form. However, after the user fills out the form and submits it. Instead, of being redirected back to our web app, he is sent to Twitter where it says:
"#sessions" does not exist
Anyone else experience this before? At this point, I don't know if this is a Twitter API issue or the way I am supposed to redirect with the gem.
The issue also seems apparent with other people:
https://twitter.com/Starbucks/status/482656278410723328
https://twitter.com/CocaCola/status/483420891393826816
https://twitter.com/RayaVlogs/status/492528237629943808
https://twitter.com/MattNavarraUK/status/494915033634447360
https://twitter.com/WillHillBet/status/497021431021330433
Update: Searching #sessions on Twitter, returns several people experiencing the same issue. It may be related to Twitter's API, more than anything. Apparently, its also happening with their widgets. Anyone think of a workaround?

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 :)

Facebook app iframe won't attempt to load when logged in as page

I have an app that shows up as an iframe on a Page. (Here's an example.)
If you view the app tab as a Facebook user, whether you have the app installed or not, everything works correctly.
If you view the app tab as a Facebook Page that has not installed the app, everything works correctly.
If you view the app tab as a Facebook Page that has installed the app, nothing displays. In fact, when sniffing the HTTP headers, it looks like no attempt is ever made to load the app URL.
Any idea what needs to happen on the Facebook side of the equation in order to have the tab at least make an attempt to load the app's page?
Thanks!
This is now a desired behavior, once you trying to visit Application Tab by being logged in as Page you'll be prompted to use Facebook as regular user:
To access this page, you'll need to switch from using Facebook as your page to using Facebook as yourself.
BTW, this was described in bug Blank app page which is marked as fixed (and the described behavior sadly was a way to fix this)...

Resources