Set user info

  • Since SDK: 20

Assigns the auth token and user name for the viewer to persist. Only the authToken value is used to determine entitlement. The username is additional data availbale to the JS API and has no relation to user login credentials. To log a user out call this function wiht an empty authToken value. Notice that there is no callback for this function invalid values for either authToken or userName will make this function fail silently.

adobe.dps.store.setUserInfo

Parameter Type Description
authToken

string

String containing the auth token or undefined in order to sign out.
userName

string

String containing the user name used to sign in or undefined to clear the persisted user name.

API Snippet

setUserInfo

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>setUserInfo API</title>
<script type="text/javascript">
function setUserInfo()
{
  if (window.adobedpscontextloaded)
  {
    var authToken = document.getElementById("authToken").value;
    var userName = document.getElementById("userName").value;
    // call into the setUserInfo API
    adobe.dps.store.setUserInfo(authToken,userName);
  }
}
</script>
</head>

<body>
<p>Set User Info</p> 
<input type="text" id="authToken" value="authToken"/>
<input type="text" id="userName" value="userName"/>
<button type="button" onclick="setUserInfo()">Set User Info</button>
</body>
</html>