Authenticating with a custom embedded form

I’ve been going round in circles with this. I have a need to have the user login form on the main site, so avoiding directing the user off-site to auth0.

I begain with Lock.js but that loads the Auth0 form as an overlay, so that’s not meeting the requirement.

I then tried posting my own form to a PHP method. I couldn’t see a method in the PHP SDK that lets me pass credentials to auth0, instead you call login() and that redirects you off-site. So a non-starter there too.

I moved onto Auth0.js and successfully submitted my on-site form and returned to a URL on my site where I was hoping to use the PHP SDK to get the user details so I can create a user in my application, and log them in. However the state fails to verify presumably because the process was instigated with Auth0.js rather than with the PHP SDK.

Sticking with Auth0.js I can’t see an exchange method that’s equivalent to the PHP SDK, and when I change the responseType to token, I can’t see how to get the user’s profile from the token. The docs mention a getUser method but that doesn’t exist on Auth0.js.

So how can I achieve this seemingly simple task - to use my own form, on my own site?

Hi there @russback welcome to the community!

If you do in fact have an access token, you could use it against the /userinfo API directly - Alternatively, have you had a chance to look at the parseHash method in Auth0.js?

Hope this helps!

1 Like


The lock library has an option to load in a container rather than as an overlay, I just hadn’t spotted that when getting lost in the docs.

Persevering with that for now, and we’ll see if there are enough customisation options to support the client design and ux requirement.

1 Like

Awesome, thanks for the update! For future reference, the configuration option to load the widget in a container rather than a modal can be found here.

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