XMPP Login Via Gmail id in iOS is causing not authorised error
<p>I am new to XMPP frame work I have followed the steps which are mentioned in the following link <a href="https://github.com/robbiehanson/XMPPFramework/wiki/GettingStarted_iOS" rel="nofollow">Getting started using XMPPFramework on iOS</a></p>

<p>In XMPP Setup method I have configured my domain and the port as shown below.</p>

<pre><code>- (void)setupStream
{
    NSAssert(xmppStream == nil, @"Method setupStream invoked multiple times");
    xmppStream = [[XMPPStream alloc] init];

#if !TARGET_IPHONE_SIMULATOR
    {
        xmppStream.enableBackgroundingOnSocket = YES;
    }
#endif

    xmppReconnect = [[XMPPReconnect alloc] init];

    xmppRosterStorage = [[XMPPRosterCoreDataStorage alloc] init];
    //  xmppRosterStorage = [[XMPPRosterCoreDataStorage alloc] initWithInMemoryStore];

    xmppRoster = [[XMPPRoster alloc] initWithRosterStorage:xmppRosterStorage];

    xmppRoster.autoFetchRoster = YES;
    xmppRoster.autoAcceptKnownPresenceSubscriptionRequests = YES;

    xmppvCardStorage = [XMPPvCardCoreDataStorage sharedInstance];
    xmppvCardTempModule = [[XMPPvCardTempModule alloc] initWithvCardStorage:xmppvCardStorage];

    xmppvCardAvatarModule = [[XMPPvCardAvatarModule alloc] initWithvCardTempModule:xmppvCardTempModule];

    xmppCapabilitiesStorage = [XMPPCapabilitiesCoreDataStorage sharedInstance];
    xmppCapabilities = [[XMPPCapabilities alloc] initWithCapabilitiesStorage:xmppCapabilitiesStorage];

    xmppCapabilities.autoFetchHashedCapabilities = YES;
    xmppCapabilities.autoFetchNonHashedCapabilities = NO;

    // Activate xmpp modules

    [xmppReconnect         activate:xmppStream];
    [xmppRoster            activate:xmppStream];
    [xmppvCardTempModule   activate:xmppStream];
    [xmppvCardAvatarModule activate:xmppStream];
    [xmppCapabilities      activate:xmppStream];

    // Add ourself as a delegate to anything we may be interested in

    [xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()];
    [xmppRoster addDelegate:self delegateQueue:dispatch_get_main_queue()];

    [xmppStream setHostName:@"talk.google.com"];
    [xmppStream setHostPort:5222];

    // You may need to alter these settings depending on the server you're connecting to
    customCertEvaluation = YES;
}
</code></pre>

<p>In XMPP connect method I have hard code my user name and password as follows</p>

<pre><code>- (BOOL)connect
{
    if (![xmppStream isDisconnected]) {
        return YES;
    }
    NSString *myJID = @"myGmailID@gmail.com";
    NSString *myPassword = @"mypassword";

    if (myJID == nil || myPassword == nil) {
        return NO;
    }

    [xmppStream setMyJID:[XMPPJID jidWithString:myJID]];
    password = myPassword;

    NSError *error = nil;
    if (![xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&amp;error])
    {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error connecting"
                                                            message:@"See console for error details."
                                                           delegate:nil
                                                  cancelButtonTitle:@"Ok"
                                                  otherButtonTitles:nil];
        [alertView show];

        DDLogError(@"Error connecting: %@", error);

        return NO;
    }

    return YES;
}
</code></pre>

<p>When ever I try to login the server gives me following error</p>

<pre><code>SEND: &lt;?xml version='1.0'?&gt;
SEND: &lt;stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='gmail.com'&gt;
RECV: &lt;stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="gmail.com" id="F3D1F96501335E80" version="1.0"/&gt;
RECV: &lt;stream:features xmlns:stream="http://etherx.jabber.org/streams"&gt;&lt;starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"&gt;&lt;required/&gt;&lt;/starttls&gt;&lt;mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"&gt;&lt;mechanism&gt;X-OAUTH2&lt;/mechanism&gt;&lt;mechanism&gt;X-GOOGLE-TOKEN&lt;/mechanism&gt;&lt;/mechanisms&gt;&lt;/stream:features&gt;
SEND: &lt;starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/&gt;
RECV: &lt;proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/&gt;
SEND: &lt;stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='gmail.com'&gt;
RECV: &lt;stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="gmail.com" id="B08658B8604DA579" version="1.0"/&gt;
RECV: &lt;stream:features xmlns:stream="http://etherx.jabber.org/streams"&gt;&lt;mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"&gt;&lt;mechanism&gt;X-OAUTH2&lt;/mechanism&gt;&lt;mechanism&gt;X-GOOGLE-TOKEN&lt;/mechanism&gt;&lt;mechanism&gt;PLAIN&lt;/mechanism&gt;&lt;/mechanisms&gt;&lt;/stream:features&gt;
SEND: &lt;auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN"&gt;AHNpbHZlc3RlcjAzNgBzdWNjZXNzMTQ=&lt;/auth&gt;
RECV: &lt;failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"&gt;&lt;not-authorized/&gt;&lt;/failure&gt;
</code></pre>

<p>This might be a silly question but I don't know where exactly I made mistake in my code.</p>