简体   繁体   English

无法将用户从iOS客户端注册到Ejabberd Server-XMPP

[英]Unable to register a user from iOS Client to Ejabberd Server - XMPP

I made an EJabberd server up and running. 我使一个EJabberd服务器启动并运行。 I am writing a simple chat client in iOS where I try to register an user. 我在iOS中编写一个简单的聊天客户端,尝试注册用户。 But I am not able to register an user. 但是我无法注册用户。 I am sure the request is hitting the Ejabberd server. 我确定请求正在到达Ejabberd服务器。

The Log in server is below 登录服务器在下面

=INFO REPORT==== 2014-04-25 10:46:51 ===
I(<0.381.0>:ejabberd_listener:281) : (#Port<0.3853>) Accepted connection {{211,28,44,250},52988} -> {{172,31,0,235},5222}

=INFO REPORT==== 2014-04-25 10:46:52 ===
I(<0.398.0>:ejabberd_c2s:802) : ({socket_state,gen_tcp,#Port<0.3853>,<0.397.0>}) Failed authentication for ioc1@localhost

在此处输入图片说明

Any idea how to do this? 任何想法如何做到这一点? Is this related to authmethod? 这与authmethod有关吗?

This is what I have in ejabberd.cfg 这就是我在ejabberd.cfg中拥有的

{host_config, "localhost", [{auth_method, [anonymous]},
                                 {anonymous_protocol, sasl_anon}]}.

The following is the log from XCODE 以下是来自XCODE的日志

2014-04-25 20:46:49:384 iPhoneXMPP[1971:90b] SEND: <auth       xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="DIGEST-MD5"/>
 2014-04-25 20:46:49:620 iPhoneXMPP[1971:650b] RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">bm9uY2U9IjMzNzkzODUwOTEiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>
 2014-04-25 20:46:49:621 iPhoneXMPP[1971:650b] SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImlvYzEiLHJlYWxtPSJsb2NhbGhvc3QiLG5vbmNlPSIzMzc5Mzg1MDkxIixjbm9uY2U9IkMzN0U0NjlBLTg0RUUtNEY3RS1CNTEzLTM5RUJFREU0NzQ3NCIsbmM9MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC9sb2NhbGhvc3QiLHJlc3BvbnNlPTQzYTY5OTVlZmY2Y2UwNzA0YmJkNWM4OWZiNGU5ZDQ1LGNoYXJzZXQ9dXRmLTg=</response>
2014-04-25 20:46:49:865 iPhoneXMPP[1971:4953] RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
2014-04-25 20:46:49:865 iPhoneXMPP[1971:90b] iPhoneXMPPAppDelegate: xmppStream:didNotAuthenticate:
2014-04-25 20:46:49.865 iPhoneXMPP[1971:90b] num--680
2014-04-25 20:46:49.866 iPhoneXMPP[1971:90b] elements--(
"<username>ioc1@localhost</username>",
"<password>ioc</password>",
"<name>ioc1@localhost</name>",
"<accounttype>1</accounttype>",
"<devicetoken>680</devicetoken>",
"<email>ioc1@localhost</email>"
)

Any info will be very helpful for me. 任何信息将对我非常有帮助。 Not sure where I am going wrong Thanks and appreciate your help 不确定我要去哪里错了谢谢您的帮助

Do you really want to register(create) a new (persistent) user, or log in to (previously created) existing account? 您是否真的要注册(创建)新的(永久)用户,或登录(先前创建的)现有帐户? Or you does not want to care and want anonymous temporary logins without persistent accounts? 还是您不想在没有永久帐户的情况下关心匿名匿名临时登录? Your ejabberd now configured to accept anonymous logins, but you are trying to authenticate existing user. 现在,您的ejabberd已配置为接受匿名登录,但是您正在尝试对现有用户进行身份验证。 If you are using XMPPFramework and want to get temporary login, just use [xmppStream loginAnonymously:] and server will log you in with temporary ID. 如果您正在使用XMPPFramework并希望获得临时登录名,则只需使用[xmppStream loginAnonymously:] ,服务器将使用临时ID登录。

But if you want to use persistent accounts database, you need to change auth_method to something else (check ejabberd documentation), create user (you can create it on the server side, or register new user from client, or use existing user's database from different application) and only then you can authenticate with given username and password. 但是,如果要使用永久帐户数据库,则需要将auth_method更改为其他名称(请查看ejabberd文档),创建用户(可以在服务器端创建它,或者从客户端注册新用户,或者使用来自其他用户的现有用户数据库)应用程序),然后您才能使用给定的用户名和密码进行身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM