How do I Login inside app to use GPPNativeShareBuilder of Google API in Objective C? - objective-c

I am using Google Plus API for login purpose.
My app rejects once due to GPPSignIn (Not Google login within app), then I used GTMOAuth2Authentication for login with Google. This allow me to login inside my app.
This goes well.
I am worrying about share on Google, for same issue (rejection), I implemented GPPNativeShareBuilder, which allows me to share within app, but this goes out of app for login, when tried with same GTMOAuth2Authentication this gives me error message:-
[GPPNativeShareBuilderImpl open] User must be signed in to use the native share box.
I used this also
GTLServicePlus* plusService = [[GTLServicePlus alloc] init];
[plusService setAuthorizer:self.auth]; // authentication object!!!
This produces same warning error, not presents share dialog.
Help me, Thanks in advance.

Related

Parsing ActionCodeSettings in iOS via dynamic link

I'm trying to direct the user directly back to my iOS app when they sign up for a new Firebase account and click on the verification link in their email, but I'm unable to access the parameters generated in the ActionCodeSettings.
I'm doing this via a dynamic link, and it does redirect the user back to my app, but the url params are not exposed. I have tried the AppDelegate code from the Firebase documentation here, but no luck.
I've seen mention of an applyActionCode method in Swift but if I can't even surface the query string from the link then there's nothing for me to pass to that method anyway.
Anyone ever deal with this before?

xcode twitter api authorize screen issue

I have an app that I'm using the xcode IDE and writing in Objective-C that uses the twitter api and the 'default' twitter login page for username and password.
I already have all the oauth stuff set up and it is working fine.
I create a new view controller with a web view inside it, and pass the URL of https://api.twitter.com/oauth/authorize.
If I put in my email and password, everything works fine - the view disappears, and we are then off and running.
If I press cancel on the twitter login screen, I get a twitter page saying I need to log in. I need to capture the cancel in my code so I can dismiss the view controller, but I cannot find out what the name of the callback is? I tried didFailLoadWithError but that is not it.
Can someone shed some light on this please?
It turns out it can be handled from the same callback that handles a 'correct' login. except looking for a failure.
So, they have handled it correctly within the original callback.

Office 365 JavaScript API, redirect back to WP app after launching Store

I am creating a Windows Phone app using HTML And JavaScript. I am able to add connected services and have selected "Users and Groups" and given it Read permissions.
I am then making the following calls on button click:
var authContext = new O365Auth.Context();
authContext.getIdToken("https://TestDomain.onmicrosoft.com/TestWebApi").then(
function (token){
}
);
Services/Office365/Settings.js has been edited to the following:
Settings.clientId = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
Settings.authUri = "https://login.windows.net/common/";
Settings.redirectUri = "ms-app://s-1-15-2-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx/";
I got the redirectUri value by calling the following function:
Windows.Security.Authentication.Web.WebAuthenticationBroker.getCurrentApplicationCallbackUri();
I do get the login screen for my organization and I am able to provide credentials and it tries to redirect it back to my application, but then I get asked the following question:
"You need to install an app for this task. Would you like to search for one in the Store?"
If I click on yes, it takes me to the store and says "No apps found". If I click on no, it doesn't do anything.
How could I possibly get it redirected back to my app?
The connected services experience only works in Multi-device hybrid apps (a.k.a. Cordova), not in Windows Phone apps.

Connect Facebook Social Plugin with FB iOS SDK

In one of our app, our user already logged in using the iOS FB SDK, and in one page is am displaying the comment box social plugin to render comments, but seems it can't use the existing logged session.
Are there any steps required so user don't need to double login?
Comments box social plugin is not designed for iOS. But we can make it work by restricting the user to sign into FB only using WebView popup. To achieve this, set NO for both authorizeWithFBAppAuth and safariAuth in - (void)authorize:(NSArray *)permissions; method of Facebook.m
- (void)authorize:(NSArray *)permissions {
self.permissions = permissions;
[self authorizeWithFBAppAuth:NO safariAuth:NO];
}
This will store all the facebook credentials in sharedHTTPCookieStorage. Now when you load your comments box social plugin using webview, it will recognize the existing session.

FBConnect login, share with a webview?

I am using FBConnect in my iOS project to authorize the user (SSO).
Once logged in, I sometimes need to open a Webview in order to show the user specific dialogs such as the app request dialog (invite to app) and even to open a friend's profile page in a webview for my app user to browse.
The problem is that the Webview doesn't recognize the logged in user and asks him to login again, this is not very friendly.
Any ideas how to share the logged in auth key/cookie/something with the webview?
You are likely running into this situation. It's really frustrating.
Facebook iOS SDK not storing cookies for access
You can, if you want, force the iOS library to use your app for login, and authorize through a UIWebview local to your app. You are thus logged in, and have cookies to use. You'll have to add a method to the existing Facebook object. Normally, you call:
- (void) authorize:(NSArray *)permissions
delegate:(id<FBSessionDelegate>)delegate
to authorize, which in turns calls the private method:
- (void)authorizeWithFBAppAuth:(BOOL)tryFBAppAuth
safariAuth:(BOOL)trySafariAuth
with both parameters set to YES.
You want to add a public method that calls the same private function but with both parameters set to NO. I added this method to Facebook.m and declared it in Facebook.h so I could call it however I like:
- (void)authorize:(NSArray *)permissions
tryFBApp:(BOOL) tryFBApp
trySafariAuth:(BOOL) trySafariAuth
delegate:(id<FBSessionDelegate>)delegate {
[_permissions release];
_permissions = [permissions retain];
_sessionDelegate = delegate;
[self authorizeWithFBAppAuth:tryFBApp safariAuth:trySafariAuth];
}
I call that with the two BOOL parameters set to NO, and the library pops ups a local UIWebView that leaves me with cookies that work for the app.
FBConnect returns you a token so that you have access to the FB API not the FB website. Unfortunately this doesn't login them in through a UIWebView and set the proper FB cookies.
Another strategy would be to change in the FBConnect source code to redirect to your own UIWebView instead of the standard FB pop-out to the FB-APP process and have them login only once. You would however have to persist the cookie state of the UIWebView.
I suggest that you also take a look at http://www.getsocialize.com which can help you manage social network integration.
good luck!