Logs in a user by providing Email and Password (in clear text). However, for this to work, calling domain must be added in "Trusted Domains" section under Channel Settings. This widget authenticates the user and prepares session used by other widgets later on. Therefore if content for the logged in user is desired then this widget must be used before using any other widgets. Without using Login API, other widgets will only display content accessible to Anonymous users.


It is advised to use this widget with "HTTPS" to ensure privacy and protection of credentials sent across the wire. 


Like any other API calls, widgets.js must be loaded from your Channel domain. Here’s a sample code that shows how to Login a user who is a part of http://video.lexcorpinc.com domain. 


After successful login, this would return JSON object with MessageCode property set to ‘0’, along with user object. Below is the object returned by Login call:


Sample Code

 

<script type="text/javascript" src="http://video.lexcorpinc.com/JavaScript/bundles/widgets.js"></script>
<script type="text/javascript">
 vidizmo.api.login({ email: 'EmailAddress, password: 'Password' }, function (response) {
 
 if (response.status === vidizmo.enumerations.ResultStatus.SUCCESS) {
 // login success
 }
 else {
 // login failed
 }
 
 });
</script> 

 


Properties


Property
Comments
email
Email address of user, which will be used as login credentials
password 
User’s Password


Response

 

{
 "next_page_url": "http://consumer.enterprisetube.com/Admin/ManageMashup/ManageMashups.aspx?tab=published",
  "session_timeout_in_minutes": 1440,
  "accesstoken_created_datetime": "2014-01-21T12:47:52Z",
 "user_profile": {
 "anonymous": false,
 "default_tenant_id": 1647,
 "associations": [
 {
 "is_active": true,
 "is_deleted": false,
 "registration_status": 2,
 "user_profile": null,
 "tenant": {
 "id": 1643,
 "name": "LexCorp",
 "domain": "video.lexcorpinc.com",
 "logo_url": "//az2310.vo.msecnd.net/et-1643/117290/Images/00000c/C3E88E17373920130827123823812.png",
 "parent_tenant_id": 0,
 "weight": 0,
 "is_featured": null
 },
        "tenant_id": 1643,
 "user_id": 150807
 }
 ],
 "federateed_users": [
 
 ],
 "id": 91821,
 "first_name": "Mark",
 "last_name": "Turner",
 "email_address": "obaid.feroze@vidizmo.org"
 },
 "access_token": "HLtqDMxfm7hmBLP%2fDMS8RaDjlUGK3DY2qgCHf7YhStBgY0Ka2UKIHpLj2KvupImodV%2fhl8IQ2RS5Q6GnCaF8xfzCt9mQbpVZ%2fGVHHDXf0hmZNRQgm3YLDt%2fie5aaHEIf",
 "status": 1,
 "status_code": 200,
 "message": null



Properties


Property
Comments
messageCode
Error code returned, 0 on Success. In case of error, an error code is returned.
session_timeout_in_minutes
Session timeout in minutes. After the specified time, the session will close automatically if there’s no activity from the user. This will help the developer to maintain session.
accesstoken_created_datetime
Date and time at which the access token was created.
status
Status of login call, status=1 means call failed and status=2 means  call successful
userProfile
User object with associations (membership) of different channels


UserProfile Object


Property
Comments
anonymous
If the user is anonymous
associations
Associations or memberships of Channels
default_tenant_id
Default channel or tenant id
email_address
Email address of logged in user
first_name
First name
last_name
Last name
id
User profile id of logged in user



Association Object


Property
Comments
tenant_id
Channel or tenant Id
user_id
User id in that channel, every channel will have a different user id  for the same User Profile
tenant
Channel or tenant object

 


Tenant Object


Property
Comments
id
Channel or tenant Id
name
Name of the channel
domain
channel URL
logo_url
 
parent_tenant_id
if it’s a sub channel of an account.

 



To learn more how these Widgets work, click here on VIDIZMO JS API Implementation.

For a complete list of VIDIZMO APIs, click here on VIDIZMO Developer APIs.