How to logout using MGTwitterEngine API programmatically in iphone ?
You mean how do you log out from the current account in MGTwitterEngine?
Well, that's easy, simply send the -endUserSession-selector to the engine like this:
MGTwitterEngine *engine = [MGTwitterEngine twitterEngineWithDelegate:self];
// Login...
// Do stuff...
[engine endUserSession]; // <-- Logs out
To Logout of the Twitter from MGTwitterEngine you need to call its methods with some change. In the MGTwitterEngine.m, search for _clearCookies. This is currently set to NO, change it to YES. In your action method for logging out the current user, call [ _engine clearAccessToken].
Now run it, and voila, it works!
Related
I'm looking for a way to logout user but can't find it.
FBSDKDeviceLoginManager
doesn't have corresponding method and there is no smth like "FBSDKDeviceSession" also
There's no helper method but you can manually clear the current token:
[FBSDKAccessToken setCurrentAccessToken:nil];
I've updated the docs at with this example.
I am working on an app and would like to know how to automatically redirect someone to their profile page or a home page after they login into my app?
If relevant I am using the Parse UI to log in and sign up and coding in swift and using Xcode7
Any advice welcomed
PFLoginViewController has a delegate with calls that you can use to indicate when a user has successfully logged in. I believe it gets called when a user signs up as well, but I could be mistaken.
You can use those calls to signal a successful login/signup and then redirect to the appropriate view controller from there. If you want any more advice, you will need to be more specific with your question.
As far as I understand you want to redirect your user to specific view controller if user already logged in ? You can use below code in your app delegate file.
var currentUser = Parse.User.currentUser()
if currentUser != nil {
// Your redirect code
}
I have integrated the facebook in to my application, From the FB i will be getting the userid and the name of the user and passing it to my own service that will do the validation and allows the respective user to get in to the system. I have got the userid and username from the FB and passed it my service that will do the validation,it allows the user to enter in to app, but my problem is once i logged in , how can i log out from the FB ?
Please let me know your ideas.
Thanks
If you are using the new facebook sdk, then us
[facebook logout:delegate]
Being facebook your Facebook object,and delegate an FBSessionDelegate.
If all goes well your delegate will be called on -(void)fbDidLogout;
That depends on which library you use to connect to facebook.
But I guess that you have a FBSession class that has a logout method...
That logout method also calls deleteFacebookCookies that you could also directly call depending on your needs...
Hope that helps.
If you are using old facebook sdk,then use this code for logout.make FBSession class object and code like this. [FBSessionclassobject logout];
it will delete all FacebookCookies.
I want to authorize a user for my iphone app using Twitter. I would like to use sharekit to do this for simplicity but I am missing something fundamental. My understanding is that the way you do this is as follows:
service=[[SHKTwitter alloc] init];
[service authorize];
What is not clear to me is how I get notified once the authorization process is complete. When I execute this code, a modal view controller pops up and the user grants access via twitter. Authorization is successfully made and the modal view controller is dismissed. What I don't see is any way for me to be notified once all this is complete? What am I missing?
You could check two methods in SHKOAuthSharer (if you use OAuth to authorize):
1. - tokenAuthorizeView: didFinishWithSuccess:
2. - tokenAuthorizeCancelledView:
They where called when authorizing view is closing. So you could put your own delegate callbacks here.
Or check this https://github.com/ideashower/ShareKit/issues/187
When you use facebook connect on the iPhone do you have to use the supplied login button and login screen built into the framework? The reason I ask is because I'm also using twitter and I would like to have the same user experience when they log in to user as they have when they log in to facebook. So I can either replicate the login screen facebook connect uses for twitter or just not use the facebook connect login screen all together.
Login button: no. Login screen: yes. I added FB Connect integration to my FriendFeed app for iPhone, Stir, and skipped the login button. Instead, a user can choose a "Share on Facebook" button on a UIActionSheet and the app either displays a login screen or automatically posts a link depending on whether the user is authenticated.
Here's a code snippet for you. If the session is successfully resumed, then a method on your FBSession object's delegate will be called.
if (![fbSession resume]) {
FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:fbSession] autorelease];
[dialog show];
}
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
NSLog(#"Hooray, I'm logged in to Facebook!");
}
Apologies for being a little vague in my example above. To be honest, I find FBConnect to be a bit of a mystery and tried my best to implement it and get away from it as quickly as possible in my app. Let me know if you need more information and I'll put together a more-concrete answer.
Per the request below:
You can get an FBSession object with FBSession's +sessionForApplication:secret:delegate class method. You call -resume on the session object. If it returns YES, it'll immediately call your delegate's -session:didLogin: method, which is where you should put your FB-dependent actions. If it does not successfully -resume, then you need to create an FBLoginDialog, as seen in the code snippet above. Make sense? Let me know if you need more info