Hosted Passwordless with prefill of email address?

Hi

I have a hosted login page where I allow the user to login/signup with social login or passwordless (email).

I open the login page from AngularJS like this:

angularAuth0.authorize({
	allowed_connections: ['linkedin', 'facebook', 'google-oauth2', 'windowslive', 'email'],
	language: lang,
	nonce: getNonce(),
	login_hint: "test@example.com"
});

and at the hosted page, I do this:

var config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@'))));
config.extraParams = config.extraParams || {};

var allowed_connections = config.extraParams.allowed_connections;
var language = config.extraParams.language;
var loginHint = config.extraParams.login_hint;
var prompt = config.prompt;

var lock = new Auth0LockPasswordless(config.clientID, config.auth0Domain, {
      auth: {
        redirectUrl: config.callbackURL,
        responseType: (config.internalOptions || {}).response_type ||
          (config.callbackOnLocationHash ? 'token' : 'code'),
        params: config.internalOptions
      },
      assetsUrl:  config.assetsUrl,
      allowedConnections: allowed_connections ? allowed_connections : null,
      rememberLastLogin: !prompt,
      language: language,
      languageDictionary: i18n[language],
      prefill: loginHint ? { email: loginHint, username: loginHint } : null,
      theme: {
        primaryColor: '#4C66AC',
        labeledSubmitButton: false
      },
      closable: false,

      // we want small buttons for social providers
      socialButtonStyle: 'small'
    });

lock.show();

But the email doesn’t get prefilled!. Is there a mistake in my code, or can the passwordless email field not be prefilled?

1 Like

Update

I have installed “Real-time Webtask Logs” and can see the login_hint is part of the context object… I’t just doesn’t get used in the email field

{
  "request": {
    "query": {
      "protocol": "oauth2",
      "client_id": "...",
      "response_type": "token id_token",
      "redirect_uri": "https://.../auth0/callback",
      "scope": "openid email profile user_metadata app_metadata",
      "audience": "https://....eu.auth0.com/userinfo",
      "allowed_connections": [Object],
      "language": "da",
      "nonce": "...",
      "login_hint": "test@example.com",
      "state": "...",
      "auth0Client": "...",
      "verification_code": "632603",
      "_intstate": "deprecated",
      "_csrf": "...",
      "connection": "email",
      "email": "...",
      "popup": false
    }
  }
}

Any updates to this?

No. I’m still waiting for a response from someone who knows if/how this is possible.

The prefill option takes in an object (defining the username and/or email) - you’re passing in a string. Maybe that’s the culprit?

https://auth0.com/docs/libraries/lock/v11/configuration#prefill-object-

Edit: Seems that the prefill support for Passwordless was added less than a day ago:

Don’t know, https://auth0.com/docs/connections/passwordless/regular-web-app-email-code writemyessaytoday seems to cover all the issues.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.