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

Prefilling email address is not working with ULP #440

Closed
aounleonardo opened this issue Apr 28, 2020 · 5 comments · Fixed by #441
Closed

Prefilling email address is not working with ULP #440

aounleonardo opened this issue Apr 28, 2020 · 5 comments · Fixed by #441

Comments

@aounleonardo
Copy link

Description

This is maybe similar to #121 but they were using the classic login page.
I'm using the Universal Login Page and I cannot prefill the email address of the user with neither login_hint: <email> or prefill: {email: <email>}.

screen_hint: "signup" is correctly directing the user to the signup page, but I can't seem to prefill their email address here either.

Reproduction

<button
    onClick={() =>
        context.loginWithPopup({
            prompt: "login",
            // screen_hint: "signup",
            login_hint: "leonardo@angele.io",
            prefill: {
                username: "leonardo@angele.io",
                email: "leonardo@angele.io",
            },
        })
    }
>
    Login
</button>

Environment

  • **Version of this library used:"@auth0/auth0-spa-js": "^1.6.5"
  • **Version of the platform or framework used, if applicable:"react": "^16.13.1"
@stevehobbsdev
Copy link
Contributor

Thanks @aounleonardo. I will check internally with the relevant team but I don't believe this is possible to do. Have you come across any documentation or guidance from us which suggests that you can? I would be interested to read it if so.

@aounleonardo
Copy link
Author

aounleonardo commented Apr 28, 2020

Thank you @stevehobbsdev for replying

Mm, I don't think I found anything that talks about parameters for the new Universal Login Page but I was able to do it with the classic one by using login_hint.

Unfortunately setting the initial screen is not working with me for the Classic Login Page so that's why I am using the new Universal Login Page. If there's a way to do it with the CLP, I'd revert back to it...

Also, the documentation for Auth0Client.loginWithPopup says that the interface BaseLoginOptions has

    /**
     * The user's email address or other identifier. When your app knows
     * which user is trying to authenticate, you can provide this parameter
     * to pre-fill the email box or select the right session for sign-in.
     */
    login_hint?: string;

Only some of the options in this interface work with the ULP and it would be cool to have some docs describing what is possible or not. If there is one, I'm sorry for not finding it :/ This seems to be the only page talking about the feature gap between the Classic and Universal login.

@stevehobbsdev
Copy link
Contributor

@aounleonardo Agreed, there is a feature gap with the old and new experiences which we are slowly trying to close.

With the hosted class Lock experience, the document you're looking at is for configuring the Lock SDK (which is used by the Classic Login Page) rather than through URL parameters. If you want it so that it uses the sign-up page all the time, you can configure this by customizing the login page template (which has JavaScript on it that sets up and configures Lock). You can customize it there to always show the sign-up page using initialScreen.

What hosted Lock doesn't do is automatically map those options to URL parameters so that you can dynamically set the initial screen based on how you configure the SDK in your app. You can do this though; any extra parameters you specify to loginWithRedirect or loginWithPopup can be picked up in the config.extraParams dictionary in the template itself. So you can send a custom param, modify your template to read config.extraParams.initialScreen and then use that to configure Lock how you like. Hope that helps!

Finally, thanks for picking up the discrepancies in the code docs and our external docs too - I'll feed that back to the relevant team.

Closing this for now as I don't think there's anything to do on the actual SDK (except fix the doc), but feel free to continue the conversation if you need further guidance.

@aounleonardo
Copy link
Author

Thanks @stevehobbsdev for the prompt reply and clear explanation!

My end goal is be able to share the app to certain email addresses with a signup button. Then that person could click on it, be redirected go through my app and into the sign up page with their email prefilled. But I still want the login page to be the default choice.

I'll look into your proposed solution, but for now, I prefer to stay with the ULP (if I understand correctly it provides a smoother experience for the users), even with the lack of prefilled email and then add it, if this is going to be soon on the horizon. Do you know if there's a roadmap anywhere on when will each feature be implemented?

@stevehobbsdev
Copy link
Contributor

Do you know if there's a roadmap anywhere on when will each feature be implemented?

I don't have anything that I can share publicly, I'm afraid. Closing the feature gap between the two though as a whole is certainly on the roadmap.

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

Successfully merging a pull request may close this issue.

2 participants