Auth0 Home Blog Docs

How to stop Auth0 from open new tab


#1

Hi.
I’m using Auth0’s hosted login.
After I login, the call back is opened in a new tab, how can I make it target self? I’m using MVC example

This is what I have.

// Decode utf8 characters properly var config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@')))); config.extraParams = config.extraParams || {}; var connection = config.connection; var prompt = config.prompt; var languageDictionary; var language; console.log(config); if (config.dict && config.dict.signin && config.dict.signin.title) { languageDictionary = { title: config.dict.signin.title }; } else if (typeof config.dict === 'string') { language = config.dict; } // Set Footer year var d = new Date(); var nYear = d.getFullYear(); document.getElementById('myFooterYear').innerHTML = nYear; var loginHint = config.extraParams.login_hint; var lock = new Auth0Lock(config.clientID, config.auth0Domain, { container : 'login-lock-container', auth: { redirectUrl: config.callbackURL, responseType: (config.internalOptions || {}).response_type || (config.callbackOnLocationHash ? 'token' : 'code'), params: config.internalOptions }, assetsUrl: config.assetsUrl, allowedConnections: connection ? [connection] : null, rememberLastLogin: !prompt, language: language, languageDictionary: languageDictionary, displayName : "", /* popupOptions: { width: 500, height: 400, left: 200, top: 300 }, */ authButtons: { displayName: "Log In", }, theme: { primaryColor: '#1565C1' }, prefill: loginHint ? { email: loginHint, username: loginHint } : null, closable: false, defaultADUsernameFromEmailPrefix: false, // uncomment if you want small buttons for social providers // socialButtonStyle: 'small' }); Thank you

#2
  <script src="https://cdn.auth0.com/js/lock/11.3/lock.min.js"></script>
  <script>
    // Decode utf8 characters properly
    var config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@'))));
    config.extraParams = config.extraParams || {};
    var connection = config.connection;
    var prompt = config.prompt;
    var languageDictionary;
    var language;
    console.log(config); 
    if (config.dict && config.dict.signin && config.dict.signin.title) {
      languageDictionary = { title: config.dict.signin.title };
    } else if (typeof config.dict === 'string') {
      language = config.dict;
    }
    // Set footer year
    var d = new Date();
    var nYear = d.getFullYear();
    document.getElementById('lblFooterYear').innerHTML = nYear;
    
    var loginHint = config.extraParams.login_hint;
    
    var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
      container : 'login-lock-container',
      auth: {
        redirectUrl: config.callbackURL,
        responseType: (config.internalOptions || {}).response_type ||
          (config.callbackOnLocationHash ? 'token' : 'code'),
        params: config.internalOptions
      },
      assetsUrl:  config.assetsUrl,
      allowedConnections: connection ? [connection] : null,
      rememberLastLogin: !prompt,
      language: language,
      languageDictionary: languageDictionary,
      displayName  : "", 
      /* popupOptions: { width: 500, height: 400, left: 200, top: 300 }, */ 
      authButtons: {
         displayName: "Log In",
      },
      theme: {
        primaryColor:    '#1565C1'
      },
      prefill: loginHint ? { email: loginHint, username: loginHint } : null,
      closable: false,
      defaultADUsernameFromEmailPrefix: false,
      // uncomment if you want small buttons for social providers
      // socialButtonStyle: 'small'
    });

#3

Nevermind… it’s my base
I had target="_blank" at the header when setting base href.