Auth0 Home Blog Docs

Cross origin with login credentials is not working

login
#1

Hi.
I kind of new on Auth0 and I trying to use the Auth0 sdk in my web page for log in Auth0, however I getting the error:

“Access to XMLHttpRequest at ‘https://my-tenant.auth0.com/co/authenticate’ from origin ‘http://localhost:8080’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”

third party is enable and I using chrome
here is my code:

		window.addEventListener('load', function () {
		var params ={
			domain: '<%= domain %>',
			clientID: '<%= clientId %>',
			clientSecret: '<%= clientSecret %>',
			responseType: 'code',
			redirectUri: '<%= redirectUri %>',
			state: '<%= state %>'
		};
		var webAuth = new auth0.WebAuth(params);
		var databaseConnection = 'Username-Password-Authentication';
		function login(e) {
			e.preventDefault();
			var username = document.getElementById('email').value;
			var password = document.getElementById('password').value;
			webAuth.redirect.loginWithCredentials({
				realm: databaseConnection,
				username: username,
				password: password,
				state: '<%= state %>'
			}, function (err) {
				if (err) displayError(err);
			});
		}
		document.getElementById('btn-login').addEventListener('click', login);
	});