xcode twitter api authorize screen issue - objective-c

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.

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?

How to Sign-Out from an authenticated ListDataProvider/Authenticator in Windows Phone 8

I am reading a SharePoint list from Office 365 inside a Windows Phone 8 app. My app-code is based on this sample code from Microsoft. It uses
Microsoft.SharePoint.Phone.Application.ListDataProviderBase
Microsoft.SharePoint.Client.ClientContext
Microsoft.SharePoint.Client.Authenticator
The actual problem beeing signout not working!
On the first request to the server, the client asks for authentication and shows a hosted browser window where I can enter my account credentials. I select to stay logged in here.
If i restart the app, it authenticates me without showing the UI again.
I would like to be able to switch user or simply signout leaving no credentials on the phone behind.
I found the following static methods on Authenticator which do not change anything:
Authenticator.ClearAllCookies();
Authenticator.ClearAllCredentials();
Authenticator.ClearAllApplicationSettings();
What is the prefered way to do this?
This is an example of how I am logging out a user in my SP list App for WP8:
App.MainViewModel.IsInitialized = false;
Authenticator.ClearAllCredentials();
App.MainViewModel.Initialize();
MessageBox.Show("You have been successfully logged out, click refresh to login again.");
Your app maybe a little different, but you should at least get to the App and ViewModel to set Initialized as false. I did expxect the App.MainViewModel.Initialize() to show the login page but need to click refresh after calling this SignOut method to do so, that is why I displayed the messagebox.
Hope this helps you.

Facebook App request in iOS (not using Dialog)

I need to send a request throw my app to user's friends in Facebook (After the app on Facebook is authorized) I know there is a way to do it through the SDK :
[self.facebook dialog:#"apprequests" andParams:params andDelegate:nil];
But I don't need that way to show the dialog I just need to be able to send the request in the background when the user select the friend from (Table View for example).
Is this possible?
The Facebook Dialog API has not been updated (yet, hopefully). You can't bypass the dialog the way you want to do it.
But, you can :
preselect the friends with your own GUI and gives the apprequest the selected facebook ids. This way, the dialog is just to confirm the request.
activate the frictionless parameter, to avoid the dialog the next time you send the request for the same selected friends (the confirm dialog seems to show anyway, though, and immediately disappear, it gives a not-so-nice blink on the screen).
here's the related documentation, in case you need it : https://developers.facebook.com/docs/howtos/send-requests-using-ios-sdk/

IOS - How to create a modal user/password outside the UIApplication?

I am not sure this can be done at all...
Background: I am constructing an in-house application which means it does not get into appstore so i am not limited by the appstore guidelines.
I have a dylib which loads before the main application. It is a kind of augmenting library for applications. I am using the constructor __attribute__ to load my stuff. In there i would like to put an alertview or any kind of popup which will receive a user/password question. If the password is correct than the user is allowed to continue into the original application.
Since this is in the dylib i do not yet have a UIApplication and i do not want to interfere in the original application or sources.
Suggestions, tips are welcome...
Thanks.
This is how i've done very similar thing in my application:
0) Intercept applicationDidFinishLaunching message, add your own code, run original implementation.
1) Make opaque fullscrean UIWindow (for example, black).
2) Set its windowLevel to UIWindowLevelAlert + 1 So it hides every other window in app.
3) Add fields for user and password to this UIWindow.
I'm pretty sure you can't show a UIAlertView without having initialized the UIApplication and UIWindow instance.
Only the iOS itself can show alerts outside the application, for example when it asks for permissions or in case of iTunes or game center login ...
As a workaround you can:
make a login view inside the application
create a web application for the login process. The web app could launch the native app with a custom URL scheme and pass parameters like 'user' and 'password' to the app.
You should create a View for the Login then if you pass the login you can go on using the app otherwise you just make the app shut itself.
You could start a thread when loading your dylib and make it listen for your UIApplication to become available, then display the alert on the main thread.

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!