I am using MGTwitterEngine in Iphone application

But I am getting error in log of function
- (void)requestFailed:(NSString *)connectionIdentifier withError:
(NSError *)error
    NSLog(@"Twitter Request failed for connectionIdentifier = %@,
error = %@ (%@)",
          [error localizedDescription],
          [error userInfo]);

Error Log

Twitter Request failed for connectionIdentifier =
8E192CD3-35E5-46C8-86E9-1EADEE38B6E8, error = The operation couldn’t
be completed. (HTTP error 401.) ({
    body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<hash>\n
<request>/oauth/access_token</request>\n  <error>Client application is
not permitted to use xAuth.</error>\n</hash>\n";
    response = "<NSHTTPURLResponse: 0x603b6a0>";

following code in controller class
    // Put your Twitter username and password here:
    NSString *username = @"myusername";
    NSString *password = @"mypassword";

    NSString *consumerKey = @"b2jD5AXJewSNfmCBfzvlw";
    NSString *consumerSecret =

    // Most API calls require a name and password to be set...
    if (! username || ! password || !consumerKey || !consumerSecret) {
        NSLog(@"You forgot to specify your username/password/key/
secret in AppController.m, things might not work!");
                NSLog(@"And if things are mysteriously working without the 
password, it's because NSURLConnection is using a session cookie from
another connection.");

    // Create a TwitterEngine and set our login details.
    twitterEngine = [[MGTwitterEngine alloc] initWithDelegate:self];
    [twitterEngine setUsesSecureConnection:NO];
    [twitterEngine setConsumerKey:consumerKey secret:consumerSecret];
    // This has been undepreciated for the purposes of dealing with
    // At present the list API calls require you to specify a user
that owns the list.
    [twitterEngine setUsername:username];

    [twitterEngine getXAuthAccessTokenForUsername:username

#pragma mark Twitter methods
#pragma mark MGTwitterEngineDelegate methods
- (void)accessTokenReceived:(OAToken *)aToken forRequest:(NSString
    NSLog(@"Twitter Access token received! %@",aToken);
    token = [aToken retain];
    [self runTests];

- (void)requestSucceeded:(NSString *)connectionIdentifier
    NSLog(@"Twitter Request succeeded for connectionIdentifier = %@",

- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString
    NSLog(@"Twitter Got statuses for %@:\r%@", connectionIdentifier,

- (void)directMessagesReceived:(NSArray *)messages forRequest:
(NSString *)connectionIdentifier
    NSLog(@"Twitter Got direct messages for %@:\r%@",
connectionIdentifier, messages);

- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString
    NSLog(@"Twitter Got user info for %@:\r%@", connectionIdentifier,

Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 

Reply via email to