Google Plus iPhone API sign in and share without leaving app - ios

I have integrated the Google+ API in my App for login and sharing posts. Problem with it, is that everything requires you to leave the app and then come back (it uses URL schemes for this). This is not the expected behavior. I would like to know if there is a way to directly open up the login dialog within the my app it self without going to safari.
I really want to avoid going back and forth between safari and my app.

I just implemented same thing for my application. I have used Google's Sign In SDK. it will present Webview controller inside your app and let you login with your account, after that it will dismiss the Webview controller and call a delegate to get info for user.
Please read and follow the steps from this link,
https://developers.google.com/identity/sign-in/ios/
hope it answers the question.

Related

How to do facebook login without opening a browser at all?

The IOS app I'm currently working on uses FBSDKLoginManager().logInWithReadPermissions, which opens a browser in the app for user to login to facebook. Then, the browser closes, and the app uses the FBSDKLoginManagerLoginResult to proceed.
However, I want to change it so that the app uses preset settings to log into facebook in the background, without actually opening a browser at all. To put it in a simpler way, the app should not open the browser, but still cause a regular log-in. Is that possible?
Just to clarify, this feature is only intended when the app is running in the developer mode, not for the users.
Thank you!
EDIT: I also found FBSDKLoginBehaviorSystemAccount, which
Attempts log in through the Facebook account currently signed in through
the device Settings.
However, I have no idea about how to implement this in swift, and I cannot find any resource online besides the brief description in FacebookSDK's documentation. It will be great if someone can help!

How do I use Facebook Login via Facebook App for iOS

I have a little problem. I am sing Facebook's API to get users information. I am using the code that provide here: https://github.com/pedro1993/ios-howtos
In those examples, when somebody logs in with Facebook they are taken to the Facebook app, whereas when in my app, Facebook is opened in a UIWebView. How can I stop that from happening and use the Facebook app?
Here is an example:
Peter
Follow this official tutorial instead https://developers.facebook.com/docs/facebook-login/ios/v2.0
Update Facebook SDK has several fallback behaviors to try before it falls back to in-app web view. You can debug it by setting breakpoints in corresponding places in code. From the look of it https://github.com/facebook/facebook-ios-sdk/blob/296771f5ed7674fcbed9c31cf39bf9c8e4706403/src/Login/FBSession.m#L1039 seems like a good place to start.
Especially try to debug -[FBSessionAppSwitchingLoginStategy tryPerformAuthorizeWithParams:session:logger:.

iOS Facebook switches back to app between login & permissions

I'm trying to setup my app to publish a simple post to a user's Facebook feed (image url, link, description). They don't need to use Facebook for anything else so the first time they click "Share" it needs to authorize the app, and the publish permissions.
If they have their credentials stored in the device as of iOS 6 they simply get two alert boxes and it's done with. But if they don't, or have an older version, it switches out to Safari for login. My problem is that it is then switching the user back to my app, then immediately back again to Safari to accept the publish permission. It's very jarring and unprofessional.
What I would like is for the page in Safari to change after the login to the permissions page so they can accept it, and THEN switch back to my app. I know this can be done because the popular Mixology app does exactly this behavior. Unfortunately Facebook keeps changing their SDK and all the information I find online is outdated.
I wrote up a solution here: FacebookSDK presents login UI twice to avoid the double switch.
Basically, you can use openActiveSessionWithPublishPermissions: to do what you want. However, you have to handle the special case where the user has signed in to Facebook from the device settings, which requires requests for read and publish permissions into two separate calls.

How to prevent auto-launching of our iOS app from links in FB iOS app?

We have an iOS app that publishes certain activity to Facebook that contains links to pages on our domain. Our intention is for friends to click on those links and view them as webpages.
However, when you click on links in these published stories in the FB iOS app, it's auto launching our app instead of going to an embedded Web View or kicking out to safari.
Note: We still want to have single sign on (SSO), so just want to change the behavior of clicking links in published stories.
To clarify, this is what I'm talking about:
My app is able to publishes http://foo.com/123 into the FB newsfeed for a particular user that opts in.
That person's friends see the link, but when they click it, it just goes to http://foo.com/123 in the browser instead of launching my FOO app. This is because my app doesn't yet handle incoming context from FB iOS app.
I still want FB SSO to work from my FOO app. That is, when clicking on FB sign in in my FOO app, it jumps out to the FB iOS app (if installed) and does a single sign on and redirects back to my app. IOW, I don't want to break this authentication scenario that currently works.
What setting in the FB developers App Settings controls this? It's not clear from the documentation. I see sections for Native iOS app and Website which I currently have set but it's unclear which sub-setting affects the behavior in question. Also, it's not clear even if I was to find the setting, can I affect it without affecting SSO.
The setting you want in the Facebook App dialog is under the iOS Native section (see the screenshot below) - set both the highlighted sections to Disabled.
This won't affect Facebook login/SSO in the app, so you'll still be able to do the OAuth dances.

iOS returning from safari (or another app)

My problem is the following: in my app, I need to switch to safari for a login; however, when the user is redirected to my app, I want a specific action to be executed. Is there a way to do that? ViewWillAppear doesn't work, since it's called only the first time the views shows up....
Thanks for the help :)
You could register your iOS app to handle URL scheme 'foo', then invoke or have a link pointing to 'foo://my_custom_launch_action' from your website. When your app launches, you may read the launch options and act accordingly.
I think the official Flickr app for iPhone implements this mechanism to authenticate users through Safari from outside the app.

Resources