Token based provisioning

( The Token ( &t= ) variable in the QR codes url )

The OEM QR code provisioning system allows several variables to be added to the url of the QR Howto page, which add additional configuration options to the provisioning information sent to Zoiper.

An example url of the type mentioned above looks like this:

https://oem.zoiper.com/qr-howto.php?provider_id=4fab2ee7179e8dfada45e900766f520d&u=user123&p=pass123&a=auth1234&t=token1234

One of the variables in this url is:
&t=

It's value in the url above is:
token1234

This variable is the token.

How is the token used by Zoiper ?

The token allows Zoiper to send a (http) request to a url of the provider and get information about the following configuration variables, which will be used in configuring Zoiper:
username
password
authentication username

For this to be possible a "Token URL" needs to be provided in the configuration settings in the OEM for the Softphone.

In the OEM "Configure options" form the "Token URL" field is placed in the group of "Optional" parameters.

Here is and example usage of the Token URL and the token.

The provider configures his Softphone and types for "Token URL" the value "http://exampleprovider.com/scriptname.php?id=" in.

Then he sends the following url to an end user of his:
https://oem.zoiper.com/qr-howto.php?provider_id=4fab2ee7179e8dfada45e900766f520d&u=&p=&a=&t=t6789

When the end user scans the QR code on the page, he got to by following the url above, with Zoiper, Zoiper will receive an XML which will contain multiple configuration settings.
Two of these settings (in the format of XML tags) will be:
<token_url>http://exampleprovider.com/scriptname.php?id=</token_url>
<token>token6789</token>

The token_url comes from the Configure options form in the OEM.
The token comes from the url the provider sent to the end user.

Zoiper will now append the token to the token_url to the following result:
http://exampleprovider.com/scriptname.php?id=token6789

Now Zoiper will send an http request to:
http://exampleprovider.com/scriptname.php?id=token6789

The response should be an XML of the format:

<?xml version="1.0" encoding="UTF-8"?> <options> <accounts> <account> <username>usernamevalue</username> <password>passwordvalue</password> <authentication_username>authusernamevalue</authentication_username> </account> </accounts> </options>

Zoiper can now use the values of the variables "username", "password" and "authentication username", received with the XML, to configure the new account.

If the token sent to the Token URL does not exist in the provider's database the XML returned should look like:

<?xml version="1.0" encoding="UTF-8"?> <error> <message>human friendly error message</message> <code>404</code> </error>

One may test this functionality on:
https://oem.zoiper.com

A test/example Token URL is:
https://oem.zoiper.com/test/token1.php?t=

Available tokens are:
token1
token2

The url
https://oem.zoiper.com/test/token1.php?t=token1
will display:

<?xml version="1.0" encoding="UTF-8"?> <options> <accounts> <account> <username>user1</username> <password>password1</password> <authentication_username>authuser1</authentication_username> </account> </accounts> </options>

The url
https://oem.zoiper.com/test/token1.php?t=token3
will display:

<?xml version="1.0" encoding="UTF-8"?> <error> <message>human friendly error message</message> <code>404</code> </error>