Recognizing Safari browser login in SFSafariViewController - ios

I am working on a use case where we want to have customers using an iOS app click on a 'Login Now' button which opens the login web page in a Safari Browser. Then the customers login into my website in a Safari browser, and are redirected back from the browser to the app.
We then want the customers to use the iOS app where upon clicking 'Transact' button it launches my website's transaction web page in SFSafariViewController. The transaction requires the customer to be logged in otherwise the customer is redirected to a login page.
Given the SFSafariViewController sessions are isolated to the app context, how do we get it to recognize the previously completed browser login session?
If my browser login puts a auth cookie / session cookie client side, is there anyway I can access it and make it available to SFSafariViewController such that it too recognizes the login session?
Note: I cannot use SFSafariViewController for logins due to a constraint that is not technical. So that is not an option.

Related

Facebook login on Apple CNA

Questions:
Is it possible to set up Facebook login for use in the CNA?
Does CNA documentation exist for developers?
Can you debug the CNA screen using any developer tools?
Details:
I have created a captive portal login page that uses an email submission form or a Facebook login button. The login button uses javascript as documented on Facebook's developer resources to open a window and log the user in.
Testing:
CNA: Clicking the Facebook sign in button redirects to the facebook login, after multiple clicks. Facebook login page allows submission of username and password but does not generate these entries from cookies. After submission, the page is blank and login is not completed.
Full Featured Browsers: In Safari, Chrome, Firefox, etc. the social sign is functioning and works as expected. All browsers redirect the user to the login page, the user may use the email submission button or the social sign to authenticate on the hotspot and redirected to a landing page. The problems only occur on the CNA.
Research:
Forums threads state that it's impossible to use Facebook login in this way but I'm not sold because Social Sign In seems to be doing exactly what I'm proposing. They claim to accomplish the login without using apps so I have to assume their using either a CNA browser or launching Safari directly. Some javascript is functional in the CNA but I'm unable to track down resources to explain exactly what the capabilities/limitations of the CNA are.
Thanks for any help on this issue

Link to Ionic page from external website

I'm integrating an Ionic app with a 3rd party web authentication framework. The framework requires that the user visit a web page to authenticate and then receive several authentication token cookies.
I plan to open a link to the external login page, have the user authenticate, and then be redirected back to the Ionic app.
I need a URL to the homepage of my app so that the login page can redirect the user back after logging in. How do I generate a a URL for a location in the Ionic app?
why not just use the in app browsers plugin so that the user never has to leave the app in the first place.
https://github.com/apache/cordova-plugin-inappbrowser
Our app has a blog and we use this
$scope.readMore = function (index) {
$scope.link = $scope.articles[index].WebLink;
window.open($scope.link, '_blank', 'transitionstyle=crossdissolve,toolbarposition=top');
};
by using the option _blank we can have the user open up a webpage inside the app not have to have the navigate away from the app in order to access a url, i also looks way better than a iframe.

Safari on iPhone: Can I close the oauth browser tab?

I am using oauth to authenticate my iPhone-app's users. They click the login button and Safari opens to display the password entry page. Afterwards they are redirected using a custom url scheme, e.g. myapp://somethingsomething, which opens the application again (sending Safari into the background).
Can I close the browser tap during that redirect? Or directly afterwards via Javascript?
I ask because if my user imports a bording pass to his Passbook, Safari opens and logs my user in again, since the tab was still there.
Ok fixed by doing a setTimeout() call in JS before issuing the redirect. In the setTimeout() another redirect is executed: To a harmless page.

Facebook login doesn't work inside Twitter iOS App

I have a RoR / JQuery Mobile app that uses Facebook OAuth for authentication. It all works fine when accessing it via any normal browser on desktop and mobile with one exception.
If a user clicks a link to the app within the Twitter iOS app the home page loads within an internal webview. If the user then clicks 'Sign In with Facebook' the authentication seems to be successful but when Facebook redirects the user back to the app the page never loads. It just displays a blank page and the network indicator at the top of the screen just keeps spinning. If I close the web view and click the link again the page loads fine because the user has already authenticated.
Has any one else had problems with Facebook Auth inside the twitter app on iOS? Any suggestions on how I can resolve this problem? Is it possible this is just a bug with the Twitter app on iOS?
Thanks
I believe I found the solution. The facebook authentication process used a lot of redirects which I thought could be causing the problem (5 in total). After reviewing the process I realised I could remove one of the redirects and take the user directly to the page I wanted once they were authenticated.
www.example.com (link from the tweet)
www.example.com/auth/facebook (use clicks 'Login with Facebook')
1 - Redirect to: graph.facebook.com/oauth/authorize
2 - Redirect to: www.facebook.com/dialog/oauth
3 - Redirect to: www.example.com/auth/callback
4 - Redirect to: www.example.com/entry_path (This has now been removed)
5 - Redirect to: www.example.com/final_logged_in_path
The login process now works from within the Twitter iOS App.

Losing Oauth Authorization When App Redirects to Page Tab

I'm using the Oauth redirect authorization method to provide authorization for a page tab iframe application.
The flow works like this:
User loads page tab (unauthorized)
User clicks authorize link
Authorization dialog takes over parent window
Accepted authorization redirects to my application to register user account using authorized email.
My application redirects back to the page tab
Loading the page tab causes authorization to be lost, and the user sees the authorize link again. Rinse, repeat, no success.
Confusingly, the application works completely if instead of redirecting to the Facebook Page Tab, I redirect to any path in my application (ie. the root, the user's page, etc.). Only by setting the redirect to the Facebook Page Tab URL does the user get "booted".
Even stranger, if I keep redirection limited to my application, but simply load the Facebook Page Tab, the authorization is killed everywhere. Meaning, post-facebook-page-load, refreshing the application off-Facebook will prompt the user to authorize again, and they are effectively "logged out" of my system.
I am using Rails 3.0.1 with Devise 1.4.2 for user accounts. The user authorization is passed to a Devise registration (I need to keep track of users in my app - a voting-based "contest" application). Devise uses the "Server side Flow" detailed here: http://developers.facebook.com/docs/authentication/
I'm lost as to what would be causing this. Facebook killing the auth cookie? Does this happen?
When you access the facebook tab page first time,signed_request is necessary:
#signed_request = oauth.parse_signed_request(params[:signed_request])
So you can send a parameter when redirect to it from other pages to check if it's the first time.

Resources