<script type="text/javascript" src="https://cloud.apizee.com/agent/loaderAgent.js"/><script type="text/javascript"/>let instanceAgent; const serverDomainRoot = "https://cloud.apizee.com/"; let apiCCkey = null; let userInfos = {}; let useFrame = true; let agentAppCallback = function (agent, type, params) { switch (type) { case "init": console.log("Agent is loaded"); break; } }; let agentParams = { directory: true, // if true :print widget with availables agent directoryStartOpen: true, template: "agent-modern", useDefaultTheme: false, }; const username = "My username"; // SET YOUR USERNAME HERE const password = "My password"; // SET YOUR PASSWORD HERE $.ajax({ type: "POST", url: serverDomainRoot + "api/token", xhr: function () { var xhr = new window.XMLHttpRequest(); return xhr; }, data: { grant_type: "password", username: username, password: password, }, }).done(function (data) { $.ajax({ type: "GET", url: serverDomainRoot + "api/v2/users/me", xhr: function () { const xhr = new window.XMLHttpRequest(); return xhr; }, headers: { Authorization: "Bearer " + data.access_token, }, }).done(function (user) { console.log("users/me : Done !"); userInfos.id = user.userId; userInfos.enterpriseId = user.enterpriseId; userInfos.token = user.token; userInfos.photoUrl = "https:" + user.photo_url; userInfos.nickname = user.nickname; userInfos.mail = username; loadAgent( serverDomainRoot, user.apiKey, userInfos, agentAppCallback, useFrame, agentParams ); }); });</script>