royneary / mod_push

Other
68 stars 19 forks source link

Can't register user #13

Open l3il2D opened 8 years ago

l3il2D commented 8 years ago

I do follow this step 1 Download and build Erlang from http://www.erlang.org/downloads (Version 18.2.1) 2 Clone and build ejabberd from https://github.com/royneary/ejabberd/tree/mod_push_adjustments 3 Clone and install mod_push 4 Config ejabberd.yml like this mod_pubsub_odbc: host: "push.example.com" nodetree: "virtual" access_createnode: pubsub_createnode ignore_pep_from_offline: true last_item_cache: false plugins:

I register clients using this iq: <iq to="push.example.com" type="set"><command node="register-push-gcm" action="execute" xmlns="http://jabber.org/protocol/commands"><x type="submit" xmlns="jabber:x:data"><field var="token"><value>CLIENT_REGISTER_TOKEN</value></field><field var="device-id"><value>CLIENT_DEVICE_ID</value></field></x></command></iq>

And I get this iq: <iq to="test@example.com/mobile" from="push.example.com" xmlns="jabber:client" type="error" id="9cbbcu5eqv"><command node="register-push-gcm" xmlns="http://jabber.org/protocol/commands" action="execute"><x xmlns="jabber:x:data" type="submit"><field xmlns="jabber:x:data" var="token"><value xmlns="jabber:x:data">CLIENT_REGISTER_TOKEN</value></field><field xmlns="jabber:x:data" var="device-id"><value xmlns="jabber:x:data">CLIENT_DEVICE_ID</value></field></x></command><error xmlns="jabber:client" type="cancel" code="404"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

How can I fix this problem?

royneary commented 8 years ago

at a first glance I'm seeing you set "example.com" as register host, but are trying to register at "push.example.com"

l3il2D commented 8 years ago

already try to register at "push.example.com" but same result

royneary commented 8 years ago

Please set loglevel to 3 or higher in your ejabberd config and look for [error] and [warning] messages in your log file.

l3il2D commented 8 years ago

Now I can register already by change iq that send to register like this <iq to="example.com" type="set"><command node="register-push-gcm" action="execute" xmlns="http://jabber.org/protocol/commands"><x type="submit" xmlns="jabber:x:data"><field var="token"><value>CLIENT_REGISTER_TOKEN</value></field><field var="device-id"><value>CLIENT_DEVICE_ID</value></field></x></command></iq>

But I still can't enable push I send this iq to server <iq type="set"><enable node="MY_NODE_NUMBER" xmlns="urn:xmpp:push:0" jid="example.com"><x type="submit" xmlns="jabber:x:data"><field var="FORM_TYPE"><value>http://jabber.org/protocol/pubsub#publish-options</value></field><field var="secret"><value>MY_SECRET</value></field></x></enable></iq>

and I got this iq <error xmlns="jabber:client" type="auth" code="403"><forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error>

How I can fix this problem?

sbuzoianu commented 6 years ago

@l3il2D - I know this message is a little bit too late but I want to ask you if you solved 403 error? I have one similar situation and I think it's something wrong on config file.

sbuzoianu commented 6 years ago

If you send

<iq type="set">
       <enable node="MY_NODE_NUMBER" xmlns="urn:xmpp:push:0" jid="example.com" />
</iq>

your server will accept your request but need SECRET to activate on push_user table.

I have the same situation here and server response is: 08:59:24.710 [debug] +++++ ParsedSecret = not_found 08:59:24.711 [debug] +++++ enable: no user found! 08:59:24.711 [debug] +++++ ParseResult = not_found

If I send full stanza <iq type="set" id="61DE85C5-B1B8-448B-AA7E-C34DF28FF031"><enable xmlns="urn:xmpp:push:0" jid="example.com" node="14041760166138694754"><x type="submit" xmlns="jabber:x:data"><field var="FORM_TYPE"><value>http://jabber.org/protocol/pubsub#publish-options</value></field><field var="secret"><value>13968016932568531000</value></field></x></enable></iq>

ejabberd create an [error] entry like that: [error] {undef,[{fxml,get_attr,[<<"type">>,[{<<"xmlns">>,<<"jabber:x:data">>},{<<"type">>,<<"submit">>}]],[]},{mod_push,get_xdata_elements,2,[{file,"src/mod_push.erl"},{line,2203}]},{mod_push,process_iq,3,[{file,"src/mod_push.erl"},{line,1536}]},{gen_iq_handler,process_iq,6,[{file,"src/gen_iq_handler.erl"},{line,128}]},{gen_iq_handler,handle_info,2,[{file,"src/gen_iq_handler.erl"},{line,172}]},{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,593}]},{gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,659}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}

I supose this error is something like an incompatibility between ejabberd-16.01 and mod_push.