Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v11 is noticably slower than v10 #1227

Closed
kristiandupont opened this issue Jan 19, 2018 · 13 comments
Closed

v11 is noticably slower than v10 #1227

kristiandupont opened this issue Jan 19, 2018 · 13 comments

Comments

@kristiandupont
Copy link

After upgrading to the V11 lock, we are noticing a significant slowdown when showing the lock. Is this a known difference or might we be doing something wrong in the configuration?

@luisrudge
Copy link
Contributor

when is the slow down happening? on start? are you using the rememberLastLogin property set to true?

@kristiandupont
Copy link
Author

kristiandupont commented Jan 23, 2018

Yes, it happens on start, when trying to display the login dialog. rememberLastLogin is false.

It waits for two calls to https://secure.gravatar.com/. I am calling lock.show({ gravatar: false }). Is there anything else I need to do?

@kristiandupont
Copy link
Author

Hm, so I fixed that by also adding avatar: null in the regular options and now it doesn't make those requests. However, it doesn't seem to help much. It still sits idle for at least 6 seconds with the spinner before the dialog is shown. During that time, no requests seem to be waiting and a performance profile shows no activity going on.

@luisrudge
Copy link
Contributor

can you paste your initialization code?

@kristiandupont
Copy link
Author

function create (options) {
  var state = options.state;
  var loginGoogle = E.isTrue((E.find(state.entity.organizationSetting, R.propEq('key', 'loginGoogle')) || {value: 'true'}).value); // Note: default is True
  var logo = (E.first(state.entity.organization) || {}).logoUrl || '/static/dashboard/asset/logo/logo.png';
  var languageDictionary = Object.assign({
    passwordInputPlaceholder: buildPasswordInputPlaceholder(options),
    title: (E.find(state.entity.organizationSetting, R.propEq('key', 'loginTitle')) || {}).value || config.product.name
  }, {
    databaseSignUpInstructions: 'Choose your personal password and click Sign Up'
  }, buildLanguageDictionary(state));
  var lockOptions = {
    allowedConnections: [
      loginGoogle ? 'google-oauth2' : null,
      'Username-Password-Authentication'
    ],
    allowLogin: options.allowLogin,
    allowSignUp: options.allowSignUp,
    auth: {
      params: {
        scope: 'openid email' // Note: ensure that email is included in the JWT so we can decode and extract server side without having to query auth0 servers
      }
    },
    autofocus: true,
    initialScreen: config.feature.optimizedLogin ? undefined : options.signup ? 'signUp' : 'login',
    languageDictionary: languageDictionary,
    prefill: options.email ? {email: options.email} : {},
    rememberLastLogin: false,
    avatar: null
    theme: {
      logo: logo,
      primaryColor: variable.secondaryColor
    }
  };
  /* eslint-disable new-cap */
  lock = new Auth0Lock.default(config.auth0.clientId, config.auth0.domain, lockOptions);
  /* eslint-enable new-cap */
  lock.on('unrecoverable_error', function (err) {
    console.error('auth0 unrecoverable_error', err);
  });
  lock.on('authenticated', function (authResult) {
    options.onAuthenticated(authResult);
  });
}

function show () {
  lock.show({gravatar: false});
}

@luisrudge
Copy link
Contributor

Thanks. That's pretty normal. Can you send a print screen of the requests being made? You can filter only *auth0.com requests.

On initialization, we fetch the client configuration from cdn.auth0.com. That's the only request we should make in your case

@kristiandupont
Copy link
Author

capture

The red circle is the time where the dialog appears.
It seems that the default value for this timeout value defaults to 5 seconds. It does seem that as soon as that fires, the dialog shows. I am not sure what to make of that though.

@luisrudge
Copy link
Contributor

luisrudge commented Jan 23, 2018

Right, so, we're doing an authorize call in an iframe that returns a 400 response. Since we can't know when the iframe has an error, we wait 5s to throw the error. You can inspect the 400 response error to see what's going on with that particular request. It's probably a configuration issue. When you fix the configuration, it will be pretty fast. If, instead, you want to disable that call altogether, you can disable sso like this:

If you want to disable that authorize call, you can add this to your options:

var options = {
  auth: {
    sso: false
  }
}

@kristiandupont
Copy link
Author

Thank you, that did the trick! But is there no way around this thing if using SSO?

@luisrudge
Copy link
Contributor

See what error that authorization request is showing and fix it. To see the error, you can click the link, it will show an error page, then you click to "see more". It should have enough info.

@kristiandupont
Copy link
Author

Okay, I'll investigate. Thank you for your help!

@luisrudge
Copy link
Contributor

Depending on the error, you can also see it in the logs section of the Auth0 dashboard

@Gaspa79
Copy link

Gaspa79 commented Apr 26, 2018

Yup luis, that indeed improved the loading time considerably. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants