API Services auth-api documentation
URL Authentication
Web Portal allows a user to auto-login their account via URL signature. By Base64
encoding required fields, you can generate a signature and pass it as a parameter to the url so the web portal will auto login your account.
DEPRECATED!
Due to security reasons, this is no longer available. URL Authentication now only supports on an exiting session.
URL Format
https://productionfast.ezmessenger.com/portal?auth=1&sig=[ENCODED_SIGNATURE]&key=[CLIENT_API_KEY]
Parameters
The required parameters for the auth API
- ENCODED_SIGNATURE - this is the generated
Base64
encodedJSON
string from those required fields - CLIENT_API_KEY - Your
Client API Key
Generating a valid signature
Below are the field components required that you need to encode.
- key - the
API Key
given to you by EZ - user_id - your
Client ID
given to you by EZ - username - your
Client Web Portal
username - password - your
Client Web Portal
password - user_type - value is
1
in this case (Client login) - timeout - the URL expiration time. default to
86400
seconds
Sample code in PHP
// base URL that you are trying to redirect web portal to
// the "auth" paremeter is required
$url = "https://productionfast.ezmessenger.com/portal?auth=1";
// required fields
$key = 'YOUR_API_KEY';
$user_id = 0;
$username = 'YOUR_USERNAME';
$password = 'YOUR_PASSWORD';
// generate the signature
$signature = sign_params($key, $user_id, $username, $password);
// append to the url
$url = $url.'&sig='.$signature.'&key='.$key;
function sign_params($key, $user_id, $username, $password) {
$sig = new stdClass;
$sig->key = $key;
$sig->user_id = $user_id;
$sig->username = $username;
$sig->password = $password;
$sig->timeout = time() + 60; // 60 seconds
$sig->user_type = 1; // 1 for client access
// encode the data to JSON then Base64 then URL encode
return urlencode(base64_encode(json_encode($sig)));
}
// print the result url
echo $url;
The result will output something like:
https://productionfast.ezmessenger.com/portal?auth=1&sig=eyJrZXkiOiJZT1VSX0FQSV9LRVkiLCJ1c2VybmFtZSI6IllPVVJfVVNFUk5BTUUiLCJwYXNzd29yZCI6IllPVVJfUEFTU1dPUkQiLCJ0aW1lb3V0IjoxNDI0OTA2NTMzLCJ1c2VyX3R5cGUiOjF9&key=YOUR_API_KEY