Mention that credentials_url can/should be used with auto_login

This commit is contained in:
JC Brand 2017-05-03 09:16:01 +02:00
parent 7c057910a8
commit ed9ba78863
2 changed files with 13 additions and 3 deletions

View File

@ -250,7 +250,12 @@ soon as the page loads.
It should be used either with ``authentication`` set to ``anonymous`` or to ``login``. It should be used either with ``authentication`` set to ``anonymous`` or to ``login``.
If ``authentication`` is set to ``login``, then you will also need to provide a If ``authentication`` is set to ``login``, then you will also need to provide a
valid ``jid`` and ``password`` values. valid ``jid`` and ``password`` values, either manually by passing them in, or
by the `credentials_url`_ setting. Setting a ``credentials_url`` is preferable
to manually passing in ``jid`` and ``password`` values, because it allows
better reconnection with ``auto_reconnect``. When the connection drops,
converse.js will automatically fetch new login credentials from the
``credentials_url`` and reconnect.
If ``authentication`` is set to ``anonymous``, then you will also need to provide the If ``authentication`` is set to ``anonymous``, then you will also need to provide the
server's domain via the `jid`_ setting. server's domain via the `jid`_ setting.
@ -437,6 +442,10 @@ It allows you to specify a URL which converse.js will call when it needs to get
the username and password (or authentication token) which converse.js will use the username and password (or authentication token) which converse.js will use
to automatically log the user in. to automatically log the user in.
If ``auto_reconnect`` is also set to true, then converse.js will automatically
fetch new credentials from the ``credentials_url`` whenever the connection or
session drops, and then attempt to reconnect and establish a new session.
The server behind ``credentials_url`` should return a JSON encoded object:: The server behind ``credentials_url`` should return a JSON encoded object::
{ {

View File

@ -152,6 +152,7 @@ a `chatbox` attribute, referring to the chat box receiving the message, as well
as a `message` attribute which refers to the Message model. as a `message` attribute which refers to the Message model.
.. code-block:: javascript .. code-block:: javascript
_converse.on('messageAdded', function (data) { _converse.on('messageAdded', function (data) {
// The message is at `data.message` // The message is at `data.message`
// The original chat box is at `data.chatbox`. // The original chat box is at `data.chatbox`.