The branding API described below allows you to brand Hosted Authentication-related material (company logo, header, footer,etc.) using canned code.
For more details on fulfilling the perquisites listed above, please contact Customer Care.
1. Include the iPass Javascript library in the header section.
<head> <script type="text/javascript" src="http://openmobile.ipass.com/euservices/api/all-classes.js"></script> </head>
2. Include the attribute ipass-data in the input element of the form. For self-registration, the following fields are mandatory:
<form id="register_form"> <div> <label> <span>FirstName</span> <inputtype="text"size="20"ipass-data="firstName"/> </label> </div> <div> <label> <span>LastName</span> <inputtype="text"size="20"ipass-data="lastName"/> </label> </div> <div> <label> <span>WorldwideID</span> <inputtype="text"size="20"ipass-data="username"/> </label> </div> <div> <label> <span>Email</span> <inputtype="text"size="20"ipass-data="email"/> </label> </div> <input type="hidden"size="20"ipass-data="companyId" value="001"/> </form>
3. Create an event handler which listens to an onclick event on the button or onsubmit event on the form.
<formid="register_form"> ... <button type="submit"onclick="doRegister()"SignOn</button> ... </form>
4. Inside the event handler, call iPass register function and pass the id of the form and name of the callback function, like responseHandler as show in the example.
<head> <script> functiondoRegister(){ Ipass.register("register_form", responseHandler); } </script> </head>
5. Declare the callback function. The response from iPass will be passed to the response argument.
function responseHandler(response){ if (response.success){ ... } else{ var errorMsg = "; for (var i=0;<response.error.length;i++){ errorMsg = errorMsg + response.error[i].errorCode+';'; } alert('errorMsg = ' + errorMsg); } }
Response in XML format:
In successful case:
<selfRegistrationStatus> <errors></errors> <status><Success</status> </selfRegistrationStatus>
In failed case:
<selfRegistrationStatus> <errors> <error> <errorCode>EmailAlreadyRegistered</errorCode> <fieldName>email</fieldName> <message>Sorry! The email joe.smith@gmail.com is already taken.</message> </error> </errors> <status>Error</status> <selfRegistrationStatus>
In case of failure, the error information will be contained in an error element which includes an errorCode, fieldName, and message of the error. Based on errorCode, you can customize your error message. The following is the list of errorCode options:
Go to: Portal Home > REST API Overview