metajack / strophejs

The Strophe.js repository has moved to https://github.com/strophe/strophejs
http://strophe.im/strophejs
MIT License
810 stars 160 forks source link

login with anonymous users getting not-authorised message #105

Closed pokal4u closed 11 years ago

pokal4u commented 11 years ago

Hi,

login with registered users working fine, using anonymous user getting not-authorised error.(first time connected after refresh got this error)

my code: var connection=null; connection = new Strophe.Connection(BOSH_SERVICE);

anonymous user-----------> connection.connect('srinu@domain.com/srinu', null, onConnect);------getting not-authorised message register user----------> connection.connect("admin@domain.com/admin",'password', onConnect);------it's working

we are using strophe with bosh+ejabbered+openfire

Please help me Pokal4u

metajack commented 11 years ago

You need to use "domain.com" or "domain.com/srinu" to log in as anonymous. Specifying a user will trigger regular authentication.

pokal4u commented 11 years ago

code Hi, Thanks for reply I tried that way also like connection.connect("domain.com/pokal4u",null, onConnect); var message = $msg({to:'domain.com/srinu', from:connection.jid, type: 'chat'}).c('body').t(mes); connection.send(message.tree()); now successfully connected but not get messages from pokal4u to srinu and srinu to pokal4u

and url open in another tab previous tab disconnected.

and plesae find attached file for my code

it's important for me Please help me

Pokal4u

metajack commented 11 years ago

After you finish anonymous auth your jid will be in connection.jid. it will not be the same one you supplied, since the server assigns a random one.

I think you might gain a lot of understanding from a cursory read of the XMPP spec.

pokal4u commented 11 years ago

HI, Thanks for reply. Please tell me how can i connect? Please give me a best example. Thanks

Pokal4u