Auth0 Home Blog Docs

Auth0.js SPA Passwordless Login Without Redirect

I’m attempting to test out using the Auth0.js passwordless login. I’m slightly confused as to why I need a redirect_uri (And why this is enforced).

My setup is pretty simple (Code below).

  • I would prefer to use my own controls as the Auth0 Lock just isn’t fitting with the rest of our sites design.
  • This also means I don’t want to use Auth0 hosted pages.
  • Popup is also somewhat off the cards because I think it would be a poor experience on mobile.

So ideally I want a seamless slick JS login. Is this possible using only the JS SDK or do we need to make AJAX calls to our own app and make behind the scenes calls to make it happen.

	var webAuth = new auth0.WebAuth({
				domain: '',
				clientID: '',
				redirectUri: '',
				responseType: 'token id_token'
			});

	webAuth.passwordlessStart({
		connection: 'email',
		send: 'code',
		email: $('#login-email').val()
	},
	function(err, res) {
		// handle errors or continue
		console.log(err);
		console.log(res);

		if (err == null) {
			$('#login-step-1').hide();
			$('#login-step-2').show();
		}
	}
	);

	webAuth.passwordlessLogin({
		connection: 'email',
		email: $('#login-email').val(),
		verificationCode: $('#login-verification-code').val()
	}, function (err,res) {
		// handle errors or continue
		console.log(err);
		console.log(res);
	}
	);

Hi @Wade,

Welcome to the Auth0 Community!

It sounds like you may be interested in embedded login. I would encourage you to take a look at the pages linked below before you start your journey. There are some security concerns with embedding a login page and cross origin authentication. With that being said, it is certainly possible and should be done with an understanding of the risks.


Let me know if you have more questions,
Dan

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