CINXE.COM
<script> function SSOSetCookie(name, value, days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days*24*60*60*1000)); expires = "; expires=" + date.toUTCString(); } document.cookie = name + "=" + (value || "") + expires + "; path=/"; } function SSOGetCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } // if(SSOGetCookie('auth0_state') === null) SSOSetCookie('auth0_state', '', 30); // if(SSOGetCookie('auth0_nonce') === null) SSOSetCookie('auth0_nonce', '', 30); </script> <script src="//cdn.auth0.com/js/lock/11.3.0/lock.min.js"></script> <script src="//cdn.auth0.com/js/auth0/9.3.1/auth0.min.js"></script> <script> if(!window.location.origin) { window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); } var connectionName = 'btcom'; var clientID = 'D09N6tgQYhYCzSmEeGOVUHxZSVcpmGhc'; var domain = 'authaz.bluetooth.com'; var audience = 'https://authaz.bluetooth.com/userinfo'; var enableSSO = 'true'; var dotComUrl = 'https://www.bluetooth.com'; const SCOPE = 'openid profile email'; const RESPONSE_TYPE = 'token id_token'; const RESPONSE_MODE = 'form_post'; const REDIRECT_URI = 'https://www.bluetooth.com/login/'; const PROMPT = 'none'; const LOGIN_URL = 'https://login.bluetooth.com/?returnUrl=' + 'https%3A%2F%2Fwww.bluetooth.com%2Flogin%2F'; var currentEnv = getCurrentEnvironment(); window.onload = function() { processSSO(currentEnv); } function processSSO() { let auth = new auth0.WebAuth({ domain: currentEnv.domain, clientID: currentEnv.clientId, redirectUri: REDIRECT_URI, scope: SCOPE, responseType: RESPONSE_TYPE }); let auth1 = new auth0.WebAuth({ domain: currentEnv.domain, clientID: currentEnv.clientId, redirectUri: REDIRECT_URI, scope: SCOPE, responseType: 'code', //callbackURL: REDIRECT_URI }); let options = { connection: connectionName, state: Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5), prompt: PROMPT, nonce: 'abcd1234' }; //auth.authorize(options); if (currentEnv.ssoEnabled == 'true') { auth.checkSession(options, function (err, authResult) { // Redirect to login page or authorize url if signed-in let redirectUrl = LOGIN_URL; if (authResult) { options.state = authResult.state; redirectUrl = auth1.client.buildAuthorizeUrl(options); console.log(authResult, redirectUrl); SSOSetCookie('auth0_id_token_payload', JSON.stringify(authResult.idTokenPayload), 1); SSOSetCookie('auth0_has_authenticated', true, 1); } // return; location.href = redirectUrl; }); } } function getCurrentEnvironment() { var currentEnv = {}; currentEnv.clientId = clientID; currentEnv.connectionName = connectionName; currentEnv.domain = domain; currentEnv.dotComUrl = dotComUrl; currentEnv.ssoEnabled = enableSSO; currentEnv.lsUrl = '?returnUrl=' + encodeURIComponent(location.origin + '/Account/Login/'); return currentEnv; } </script>