Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

I’m having troubles in calling a login API from a local machine.
I’ve read through answers here and also search thew web, but I couldn’t find the reason login doesn’t work for me.
I can sign up users, but when I try to log in a previously created user I get the following error on the browser: “Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource”
I am not using a hosted login page, instead I render my own and call the Auth0 api using ‘auth-js’ npm library (version 9.1.3).
This is the source code I’m using for signup (which works fine) and for the login (which fails):
Can anyone help me here?

export default class AuthService extends EventEmitter {
    constructor(clientId, domain) {
        super();
        // Configure Auth0
        this.auth0 = new auth0.WebAuth({
            clientID: clientId,
            domain: domain,
            responseType: 'token id_token',
            redirectUri: `${window.location.origin}/`
        });
        this.login = this.login.bind(this);
        this.signup = this.signup.bind(this);
        this.loginWithGoogle = this.loginWithGoogle.bind(this);
    }
    login(username, password) {
        this.auth0.client.login({
            realm: 'Username-Password-Authentication',
            username,
            password
        }, (err, authResult) => {
            if (err) {
                alert('Error: ' + err.description);
                return;
            }
            if (authResult && authResult.idToken && authResult.accessToken) {
                this.setToken(authResult.accessToken, authResult.idToken);
                window.location = window.location.origin; //redirect to main page
            }
        })
    }
    signup(email, password) {
        this.auth0.redirect.signupAndLogin({
            connection: 'Username-Password-Authentication',
            email,
            password,
        }, function (err) {
            if (err) {
                alert('Error: ' + err.description)
            }
        });
    }

did you ever get this working?

Hey there!

Sorry for such delay in response! We’re doing our best in providing the best developer support experience out there, but sometimes the number of incoming questions is just too big for our bandwidth. Sorry for such inconvenience!

Do you still require further assistance from us?