This workflow lays out the XMLs needed in order to create a token-based authentication workflow for protecting Vid.lys. If you are not familiar with the process of designing security for URLs, please ensure to review your planned workflow with a qualified security professional.
When a visitor loads the page, a script will make a GetSecurityToken request including the visitor IP and expiration date (optional) from Encoding.com. The token is only valid for that IP and timeframe. When the token is received a response is generated adding that token to the embed code. This happens dynamically, and a new token is generated with each page load. Here is a link to a PHP sample script that executes this workflow..
Below is an example of the API call and response with this type of workflow.
XML 2:
<?xml version="1.0"?> <query> <action>GetSecurityToken</action> <UserID>****</UserID> <UserKey>*****</UserKey> <MediaShortLink/> </query>
XML 2: Response:
<?xml version="1.0"?> <Response> <Message>OK</Message> <MessageCode>7.4</MessageCode> <Success> <MediaShortLink/> <Token>1234567890</Token> </Success> </Response>
Lastly here is an example of the embed code with the token details included,
<iframe frameborder="0" allowfullscreen webkitallowfullscreen mozallowfullscreen msallowfullscreen width="640" height="360"name="vidly-frame" src="http://s.vid.ly/embeded.html?link=4i7o8u&new=1&autoplay=false&token=P2FIT1dhtsQ4-VHl~SpfkFrl3Oc0NkeSTGu~IXwIil5ltH3nqyJUlrTO4rcTco9h0zeBVADzwUANUiXzFAB-USZjmrtUlghfKqOK~zTn7m5jpYRER8TascWPILSlNoXN"><a target="_blank" href="http://vid.ly/4i7o8u?token=P2FIT1dhtsQ4-VHl~SpfkFrl3Oc0NkeSTGu~IXwIil5ltH3nqyJUlrTO4rcTco9h0zeBVADzwUANUiXzFAB-USZjmrtUlghfKqOK~zTn7m5jpYRER8TascWPILSlNoXN"><img src="http://s.vid.ly/4i7o8u/poster?token=P2FIT1dhtsQ4-VHl~SpfkFrl3Oc0NkeSTGu~IXwIil5ltH3nqyJUlrTO4rcTco9h0zeBVADzwUANUiXzFAB-USZjmrtUlghfKqOK~zTn7m5jpYRER8TascWPILSlNoXN" /></a></iframe>
That’s it! Now you're ready to test your workflow. Follow the examples below to formulate your URLs and test away!
Token example: 1234567890k5COE7~zt8FvjhHRmS4oZrYp1234567890_
Then it must be added to vidly URL like this: http://vid.ly/f2c8g1?token=1234567890k5COE7~zt8FvjhHRmS4oZrYp1234567890_