<p>When performing a registration using &xep0077;, multiple steps are sometimes needed so that the Host may ask questions based on information provided. This specification defines an augmentation to XEP-0077 for this purpose.</p>
</section1>
<section1topic='Requirements'anchor='reqs'>
<p>Multi-stage IBR must make it possible for a host to ask for further information in response to an initial registration request. It must be usable with clients that only support XEP-0077, though possibly with a degraded user experience.</p>
</section1>
<section1topic='Use Cases'anchor='usecases'>
<section2topic='Entity Registers with a Host'anchor='usecases-register'>
<p>This use case is identical to one in XEP-0077, except that it allows the Host to request further fields after an initial submission. The examples have been altered to demonstrate one such case. Errors are reported in the same way as XEP-0077, these examples show only a successful case.</p>
<p>In order to determine which fields are required for registration with a host, an entity SHOULD first send an IQ get to the host. The entity SHOULD NOT attempt to guess at the required fields by first sending an IQ set, since the nature of the required data is subject to service provisioning.</p>
<examplecaption='Entity Requests Registration Fields from Host'><![CDATA[
<iqtype='get'id='reg1'to='sms.shakespeare.lit'>
<queryxmlns='jabber:iq:register'/>
</iq>
]]></example>
<examplecaption='Host Returns Registration Fields to Entity'><![CDATA[
<p>Note: The requesting entity MUST provide information for all of the elements (other than <instructions/>) contained in the IQ result.</p>
<examplecaption='Host Informs Entity of More Fields Needed'><![CDATA[
<iqtype='result'id='reg2'>
<queryxmlns='jabber:iq:register'>
<instructions>
Enter the code you received via SMS
</instructions>
<password/>
</query>
</iq>
]]></example>
<p>If the host requires additional information above and beyond the data elements specified in the schema, it SHOULD use Data Forms as described in the <linkurl='https://xmpp.org/extensions/xep-0077.html#extensibility'>Extensibility</link> section of XEP-0077.</p>
<examplecaption='Entity Provides Further Information'><![CDATA[
<iqtype='set'id='reg3'>
<queryxmlns='jabber:iq:register'>
<password>123456</password>
</query>
</iq>
]]></example>
<examplecaption='Host Informs Entity of Successful Registration'><![CDATA[
<iqtype='result'id='reg3'/>
]]></example>
<p>When no more fields are requested, the registration is complete.</p>
<p>A given deployment MAY wish to redirect users to another medium (e.g., a website) for further stages of registration, rather than allowing in-band registration. The recommended approach is to include only the <instructions/> element rather than the required fields or a data form in the IQ result, as well as a URL encoded using &xep0066;</p>
<examplecaption='Host Redirects Entity to Web Registration'><![CDATA[
<iqtype='result'
from='sms.shakespeare.lit'
id='reg2'>
<queryxmlns='jabber:iq:register'>
<instructions>
To complete registration, visit https://www.shakespeare.lit/sms-verify
</instructions>
<xxmlns='jabber:x:oob'>
<url>https://www.shakespeare.lit/sms-verify</url>
</x>
</query>
</iq>
]]></example>
</section2>
<section2topic='Client Does Not Support Multi-stage Registration'anchor='usecases-fallback'>
<p>To support clients that do not implement this specification, the Host SHOULD respond to a query for the registration fields according to what it still needs to know.</p>
<examplecaption='Entity Requests Registration Fields from Host After One Stage'><![CDATA[
<iqtype='get'id='reg3'to='sms.shakespeare.lit'>
<queryxmlns='jabber:iq:register'/>
</iq>
]]></example>
<examplecaption='Host Returns Registration Fields to Entity Based on Current Stage'><![CDATA[
<iqtype='result'id='reg3'>
<queryxmlns='jabber:iq:register'>
<instructions>
Enter the code you received via SMS
</instructions>
<password/>
</query>
</iq>
]]></example>
<p>Hosts SHOULD expire partial registrations after a reasonable amount of time, after which such a query would return the initial fields again.</p>