SFSafariViewController OAuth implementation - ios

In the apple WWDC 2015-504, the SFSafariViewController has been announced.
Ricky Mondello claimed that the new secure, stable, and fast embedded Safari browser is capable of creating authentication flows, with two easy steps, passing though AppDelegate.
I wanted to give it a try, so i searched a bit on the implementation for OAuth2 using SFSafariViewController... I found almost nothing. There are plenty of articles explaining why the SF(...) is better than a UIWebView and so on, but i couldn't find a working implementation, not even in GitHub.
I tried to open a simple url such as "http://www.google.com" and everything works just fine.
I wanted to go one step further: i've tried implemented login with OAuth in order to receive the auth token (first step of flow).
So sent my SF(...) to "https://website.com/auth?ID=...&access=..." and set as redirect URI testApp:// (The name of my app).
I was expecting to see the request in - application:openURL:sourceApplication:annotation:
but nothing at all happened.
I've also added "testApp" in 'LSApplicationQueriesSchemes' but i have had no luck.
It's been one day struggling on this problem, and i would really like to know what am i doing wrong.
Thanks.

After another day, i can assume that the iOS 9.0.2 Jailbreak was causing the url scheme issue.

Related

URL Scheme for Launching BlueJeans App on iOS?

I'm writing up an app for connecting people to videoconferencing options, and I want the ability to directly launch installed apps (on an iPhone/iPad) from the app.
The way to do this, is to register an app's scheme in the plist, then use that scheme in a URI.
I do that already with Google Maps and Zoom. Here's the Zoom page on that (the scheme is "zoomus").
I am trying to find the same scheme for the BlueJeans app, and I'm having a devil of a time, doing that. I don't want to embed their API. I want to call an installed app.
I may be able to figure it out by looking at their API (depending on how opaque it is), but I wanted to ask here, first, in case I missed something. I did root through their documentation site, and didn't have much luck. It's a fairly balkanized site.
So far, I see only that they support installing their API, which ain't happening.
I will also be looking for the answer elsewhere, and I have opened a support case with them.
OK. I found it.
Completely by trial and error (BlueJeans never responded to me).
It's "bjn".

branch test app link weird behaviour for facebook/twitter deep linking - iOS

I am using branch for deep linking on facebook as well as twitter. Deep linking opens up my app successfully and I am also able to retrieve all the parameters correctly. But at one instance, it stopped working and said developers are working on it and after 2 days started working again after I submitted a ticket to Branch and without me changing anything. But this weird stopping and starting of link is not good for app users. Can someone from Branch help me know the possible cause for the same, as for the live app, this would create a problem?
The reason why you are experiencing this issue is that apps like Facebook, Twitter, Instagram and Snapchat prevent users from opening a third-party app via Universal Links. One way to mitigate this issue is to use forced redirections via URI Schemes on the in-app browser. You can enable forced redirections on Branch links by appending $uri_redirect_mode=2 as a query parameter.
eg:
https://example.app.link/j93str?$uri_redirect_mode=2
If you are still experiencing issues, please write to integrations#branch.io with a video recording of the link redirection behavior and one of our engineers would be able to help you with this.
Branch documentation includes two types of method calls - synchronous and asynchronous calls to method that generates url. If we are using asynchronous call, it would take time to give us the url so need to check for url first before posting it on social sharing and if we are using synchronous call, we get a short url which can be easily shared to social sites. This is what made a difference for me!!

Post to Pinterest from an iOS app without leaving the app?

I successfully integrated the Pinterest iOS SDK and can pin items, but it takes the user out of the app. Is there a way to do this but stay within the app?
I followed this guide already (How to integrate Pinterest in ios application)
The SDK provided by Pinterest only has the Pin it functionality, as described on their developer website. You cannot login with that SDK, but you can Pin images with it.you can login but can't get the response.
Pinterest has no official API for logging in, but they do use OAuth2 protocol. So you might have to write your own UIWebView handler that will allow the logging in. This will require research of OAuth2 protocol and storing cookies.
Check this GitHub project.
There is some more information in the following questions:
Log in with Pinterest
pinterest api documentation
may be this help you.
Yes you can pin items without leaving your app. It is mentioned in other answers, Pinterest has no official API. However their original web site using HTTP POST methods and you can do same thing programatically with using NSURLRequest and NSURLConnection or any other wrappers as like AFNetworking.
It is kinda hacky way but since they have no API this is the only way to do it. Only the downside, if they change something on their site code you should update your code regarding. I have released a OS X application couple months back, it is working fine since then.
I would like to write everything down here however it is almost complete application, this why I have prepared a sample app for you. If you decide to use this you have to tidy up the code little bit. You can download sample project from GitHub
How it works: Basically you have to login to Pinterest with using UIWebView, once you logged in UIWebView write cookies, we are going to use those cookies in HTTP headers to authenticate. (If you want to support social media logins you have to implement those separately)
Once we have the cookie, first thing first getting board list. -(void)getBoardList, then next step is choosing the board which you want to pin (you have to implement this, for now it show up 1st board in the list).
Pinning is two step operation here, At the first step you need to upload image to storage of Pinterest which -(IBAction)uploadImage:(id)sender method handles it. If image upload success it automatically call -(void)pinImage:(NSString *)imageURL to register your image to the selected board.
When you review the code you will see all variables hardcoded, you have to implement all of them as well. As I said this is at least gives you the idea how you can pin image to Pinterest. There is not error control in the code as well. while trying if you don't have any board, probably it will throw and error.
No, you cannot currently pin an item without leaving your app. The Pinterest API is pretty limited in my opinion. The only pinning functionality that they support for iOS is detailed in the iOS Pin It SDK, which is what you are already using.

Facebook iOS SDK Pass parameter with app requests

I would like to have my native iOS app send a request with a parameter to a Facebook user on iOS. If they accept, it will launch my native iOS app and pass it the parameter. Is this possible?
I am having marginal success using [facebook dialog:#"apprequests" andParams:dict andDelegate:self]. I am getting the bookmark counter to increment on Facebook iOS app, but I do not see the individual requests. If I tap the bookmark it launches my app but I do not see how I can get the "data" parameter I passed with the request, or even the request_id.
On desktop I see the individual messages under "Requests" section of "Apps and Games". If I accept a request, I can see it pass the request_id to my (simple echo) canvas URL. I read this can be used to fetch the associated data. But, this does not help me on iOS. My app only runs on iOS, so this canvas app will eventually just be a "this app only works on iOS," but it seemed to be necessary to get the requests to flow.
Neither of these are showing me Notifications, so maybe I am doing something basic wrong. Or, is there some other way to pass a message to a Facebook user, with a URL they could click (to launch and feed my app its parameter).
One other odd thing, I do not see how to get rid of the Requests. If I "X" them on the desktop client, it asks me if I want to stop receiving all requests from my app, and if I say no, it only hides them temporarily.
Leif, Hi - I'm the engineer at Facebook who wrote the tutorial you've referenced.
I've taken a look at the issue you've mentioned - this is in fact not a bug in the documentation and is by design.
The incoming url from a request on iOS looks something like this:
fb480369938658210://authorize?expires_in=3600&access_token=BAAG05NeN86IBAC31YWMWRHVrNCAYMy0Rv1OtqZCwdH8QDBUAt5KgZCsIbU0EOZAvMms2tZCANV9sZBWSkEzStDtt4i7YnYZA4bPgGx2XaI5s22iBMxIZAneZAv7ADi3Wi20ZD&target_url=http%3A%2F%2Fm.facebook.com%2Fapps%2Ffriendsmashsample%3Ffb_source%3Dnotification%26request_ids%3D364209433669109%252C379616028785376%252C494409170593789%252C489782271042929%252C328564930575784%26ref%3Dnotif%26app_request_type%3Duser_to_user
This is bundling together several requests, with multiple request ids into a single url.
To get the extra data coupled with this request, it is not required to have the user_id. Hitting graph.facebook.com/*request_id* is enough.
You can actually see this outlined in the documentation here: https://developers.facebook.com/docs/requests/#deleting under the 'Request ID Format' heading.
The code contained in the Friendsmash sample and on the tutorial works correctly - I verified it just now. So it should serve as a good guide to the OP's question.
Thanks!
I have been struggling with this too.
First, the FB iOS SDK requests tutorial is a good start.
However, there are also a few bugs that makes things not work as expected:
It seems that currently, a mobile web url has to be set up for the FB app in order for requestIds to be forwarded from the native FB app to your native app. See this bug report.
The tutorial mentioned above uses an erroneous graph path for the request object. I uses "request-id" where it should be "request-id"_"user-id". I have filed a documentation bug report on that issue.

BrowserField crashes in BlackBerry 7

I am trying to create an application on BlackBerry 9930 simulator that authenticate the user with Facebook, using the BlackBerry Facebook API. It connects to the login page fine, but after that the entire application crashes, either when asking to review the permission or when the login has succeeded.
I noticed that the authentication process went well since I get a message from Facebook that there is a login, so I am suspecting either the problem with the browserField and/or the simulator. (I tried 3 different BB 7 simulators, all the same though).
Anyone has a way to resolve this? Thank you so much.
It seems that no one has any solution for me :(. But, after messing around with it, I have found an explanation and a solution for it and I think I should share this with you. Sorry for the lateness in the response, though.
Here is the story.
As you probably already know, after supplying the credentials, Facebook returns the access token in the URI which is followed by the # symbol. Now, the BlackBerry Facebook API overrides the handleNavigation() method to ensure that, if the URL contains the access token, it will not be processed. This used to work in earlier versions (prior to BB 7) but somehow, it seems that URL redirection in BrowserField are no longer calling handleNavigation(), but rather handleResource() directly (I don't know why and, to my knowledge, there is no documentation for this change anywhere). The result? It always tries to process the URL that contains the #access_token in it.
Worst, the BB BrowserField thinks that # means a jump to a portion of the page (which doesn't exist). Other browsers (including the BlackBerry Browser) seems to understand that already and print only "Success" on the screen, while the BrowserField does not. And when that happened, the application just stopped working and crashed, sending me back to the home screen.
So what I did was I changed the source code of the BlackBerry Facebook API so that handleResource() now checks by itself whether the access_token is in the URL. Then, the application works fine.

Resources