Authorization Token

All agent side requests to the Presence Service carry an Authorization Token which can be obtained from the Glance Web Service. Glance uses the JSON Web Token (JWT) standard for creating, signing, and verifying authorization tokens.

A valid JWT:

  • Guarantees that the agent has been authenticated by Glance.

  • Indicates the specific privileges that the agent has.

If an agent is a member of multiple groups, bear in mind that the token is always group specific. To carry out an API operation in a particular group, the agent needs an Authorization Token for that specific group.

NOTE: Authorization is resource intensive. To prevent performance problems, reauthorize only when the previously issued token expires. See the Presence Security Whitepaper for additional information on the Authorization Token.

Glance Authorization Service Web Service

An authorization token may be obtained server side using the Glance Authorization Service SOAP or REST API.

Providing the Authorization Token to the GLANCE JavaScript APIs

The Authorization Token may be specified in metadata by adding the HTML attribute:

data-authtoken="[authorizationtoken]" to the cobrowsescript element.

The Authorization Token must appear on every page which makes API calls that require a token.

Alternatively, you can call GLANCE.Authorization.setToken(), documented below.

GLANCE.Authorization Javascript API

params object:

  webserver: "", //optional, defaults to
  service: "presence",
  groupid: 12345, // Numeric group id.  Required if the user belongs to multiple groups.
  credentials: {
    username: "", // Glance account username
    password: "password", // Glance account password
    gssnid: "", // Glance website login session id
    partnerid: 12345, // Partner id, usually same as groupid
    partneruserid: "", // Partner user id
    loginkey: "", // Login key signed with secret api key (*See additional login key documentation below),
    g4scredentials: // Glance for Salesforce credentials (*See additional login key documentation below)
  duration: 20, //duration of the authorization token in minutes, 1-120
  onsuccess: function() {...}, // called if Authorization succeeds
  onfail: function(reason) {...} // called if Authorization fails

*Additional login key documentation is available here.

All credential properties are optional, but one of the following must be specified:

  • username and password
  • username and g4scredentials
  • username and loginkey
  • gssnid
  • partnerid, partneruserid, loginkey

A reason code is passed to the callback function on failure.

When authorizing client-side using the GLANCE.Authorization API, Glance caches the authorization token in local storage and reuses it; subsequent calls to GLANCE.Authorization.authorize() will call onsuccess() immediately. To force a new token to be obtained, call clearToken() first.


Use setToken if the authorization token is obtained server side and is passed via JavaScript.


Clears the token, which may have been cached in local storage.

By continuing to use the site, you agree to the use of cookies. Learn More