embedding Javascript in SFSafariViewController - ios

I'm not sure if it's possible. I'm currently developing an app the stores password (like a password manager). One of its features is to allow user to make an auto login to a web browser of that device. I was able to make it work using UIWebView and WKWebView but can't find a way to make it work using SFSafariViewController. I read few documentations and blogs about it and even read the SFSafariViewController.h but there's no clue in there that can lead me to the function that I wanted. I want to know how to do a "evaluateJavaScript"-a-like function in SFSafariViewController or if its not possible, do you guys have other suggestions on how to achieve this?
Note: I'm using Objective-C.
Thanks in advance!
Happy coding!

SFSafariViewControllers are sandboxed. As they are essentially Safari, and have access to cookies. It would be a security risk to allow any app to access these.
However, if the web-service you want the user to sign in to is yours, you can setup a API and a custom URL scheme.
Follow this documentation.
If you are trying to store passwords etc from sites you don't maintain then unfortunately, this is not possible using the SFSafariViewController.
Hope this helps,
Liam

Related

Which one is better for OAuth process? SFSafariViewController? WKWebview?

I'm using SFSfariViewController for OAuth process. Using this I'm getting a quite well response. Whenever redirecting happens, it's opening my app. But when the request fails, I'm not able to show any alert to the user to indicate authentication failed. At this point, I can't customize SFSafariViewController as it won't allow customizations. So that's why I want to move to WKWebview which allows customization.
Even though WKWebView allows customization, From this article it's saying that Web views are not good to use for OAuth process and using SFSafariViewController is the best in this situation.
My Question:
Which one has to use WKWebview? or SFSafariViewController?
If so, Why?
Thanks in advance!
SFSafariViewController.
It's better for:
user security
credentials protected from app developer
ease of use for users
use of stored Safari credentials
Safari shared cookies/authentication maintain login across apps
I think it's fairly safe to say Apple will start enforcing the use of SFSafariViewController for the OAuth flow for the sake of customer privacy and security.

Is it possible to use safari cookie in Application web view

I just want to know if you think it's possible to get credentials from safari cookie to log someone directly in web view in my app.
I have a "linkedin connect" way to connect into my app.
For the moment, if you have the Linkedin application installed on your device, you could connect in one click. But if you don't have it locally, I opened a webview on linkedin to ask you if you are ok to give us access to your information to create your profile. But currently the user has to re-enter their email and password manually since they don't benefit from the browser's login data.
I would like to fill the field or connect directly the user if he was connected in safari, Do you think it's possible, if yes, what can I used to do this?
Thank you!
NO, thats not possible. Safari is different app than your app and hence web view is safari don't share anything with web view with your app until it has extension to share.bjects of UIWebView class and Safari or other browsers are different and sandboxed. You can check here (official documentation.)
What you want with Linked in is possible with Facebook -- because face book login authentication method provides way to share data between apps -- But in Linkedin there is no similar way.
As given in the answer here, Safari and UIWebview don't seem to share cookies as they are sand boxed from one another.

How can I maintain user credentials (django server) in a way that bypasses the login page on an iOS app even after turning the phone off?

I've been told to use Oauth2.0, but I don't understand what I am to do with it on either side.
I would specifically like to achieve the persistent login that Facebook and Twitter maintain in their respective iOS apps.
PLEASE give me a specific answer (and hopefully an example too!)
I know that this may be achieve with Oauth2.0, but I have been unable to find an example as to how (even after extensive research- if I could find the answer I wouldn't be asking the question here.)
Thank you in advance!
-John

How to login into a youtube account on iPhone

I want to implement Youtube login authentication in my application. Is there any api that allows this, that I can implement? If so, where could I find it and how would I go about implementing it? I searched a lot but haven't found any solution. If possible, please provide code also.
You can use Objective-C Client.
Here are few samples.
In iOS you need to do the OAuth2 using WebView.
Here's a great explanation talk.

accessing FBSession token from html in a UIWebView

I have an app that I want to integrate with Facebook. It is a hybrid app with a native part and a javascript part that is in a UIWebView. I would like the user to be able to be logged into "both" parts. What is the standard way of handling this? Does the facebook sdk 3.1 natively handle this? Do I need some way of passing it in the url that I instantiate it with? Can I access NSUserDefaults from javascript? Can I create a custom handler to get at it?
I googled but due to common nature of words wasn't able to find anything that addressed this. I did read that LinkedIn's hybrid app actually ran a local server for accessing user data. This is more than I want to do. Any help is appreciated and sorry if this is addressed by Facebook SDK but wasn't able to find id.
thx in advance

Resources