ECM
ECM
总版主
总版主
  • 社区居民
  • 忠实会员
  • 原创写手
阅读:1008回复:0

XMPP: Registration gives error in iOS

楼主#
更多 发布于:2016-01-07 16:54
Hi I a using the below code for registration.


After xmppStream has been connected then I call this code inside didNotAuthenticate method:


- (void)xmppStream:(XMPPStream *)sender didNotAuthenticate:(NSXMLElement *)error{


    NSString *jidStr = @"mohit@localhost";
    NSString password = @"mohit";
    XMPPJID *jid = [XMPPJID jidWithString:jidStr];
    [self  xmppStream].myJID =jid;


    if (self.xmppStream.supportsInBandRegistration) {
        if (![self.xmppStream registerWithPassword:password error:&error]) {
            NSLog(@"Registration error: %@", error);
        }
        else{
            NSLog(@"Registration on progress");
        }
    }
    else {
        NSLog(@"Inband registration is not supported");
    }}
in Console it prints the "Registration on progress" but in the below delegate method


- (void)xmppStream:(XMPPStream *)sender didNotRegister:(NSXMLElement *)error{
    DDXMLElement *errorXML = [error elementForName:@"error"];
    NSString *errorCode  = [[errorXML attributeForName:@"code"] stringValue];
    NSString *regError = [NSString stringWithFormat:@"ERROR :- %@",error.description];
    NSLog(@"%@",regError);}
It gives error:


<iq xmlns="jabber:client" from="localhost" type="error"><query xmlns="jabber:iq:register"><username>mohit</username><password>mohit</password></query><error code="403" type="auth"><forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
I am using the ejabberd server. Please help me on this.


ios objective-c xmpp ejabberd xmppframework


shareedit


asked Jun 3 '14 at 21:11






Anshu
8018








Just enable registration in ejabberd configuration file – vitalyster Jun 4 '14 at 14:56






Ejabberd configuration problem. – Jagveer Singh Rajput Jun 16 '14 at 10:22






I don't think so. I have it set to register [{allow,all}] – user83039 Nov 17 '14 at 5:53


add a comment




1 Answer


activeoldestvotes




up vote
2
down vote


Following steps worked for me


Go to your Ejabbered admin home page and login with admin credentials. ("http://YourServerHostName:5280/admin/")


Click on "Access Rules" from left side menu.


In the textfield at the bottom the page, paste the following access rule and click "Add New".


{access, register_from, [{allow, all}]}


This should eliminate the 403 forbidden error.


After forbidden error is resolved one more error may arrive that is "Users are not allowed to register accounts so quickly". For this again copy and paste the following access rule in the same textfield and click "Add New".


{access, register, [{all, allow}, {registration_timeout, infinity}]}


This should eliminate the above error.


shareedit


answered Oct 14 at 20:51






Teena nath Paul
488412








Great! For me it worked to go to Virtual Host-Nodes-Modules-mod_register and add the access rules you described. – Bojan Bozovic Nov 4 at 15:08


add a comment

 

 

 

 

 

 

 

异常中心网是一家专门收集整理程序员编程过程中遇到的常见异常(exception)以及各种异常问答中心的网站。异常中心网旨在,减少程序员在编码遇到异常,处理各种异常时间和痛苦,让程序员能更愉快的、快速的定位异常并查找对应的异常解决方案。异常中心网诚心打造最完美的编程社区为程序员用户服务,努力成为最好的程序员乐园程序员社区程序异常中心程序bug中心异常问答中心

 

喜欢0 评分0
游客

返回顶部