CORS issue Searchbox autocomplete

I am referring this tutorial with stable version 5: Searchbox Integration

var options = {
            searchOptions: {
                key: '<your-tomtom-API-key>',
                language: 'en-GB',
                limit: 5
            },
            autocompleteOptions: {
                key: '<your-tomtom-API-key>',
                language: 'en-GB'
            }
        };
        var ttSearchBox = new tt.plugins.SearchBox(tt.services, options);
        var searchBoxHTML = ttSearchBox.getSearchBoxHTML();
        document.body.append(searchBoxHTML);

Getting this error:

Access to XMLHttpRequest at β€˜https://api.tomtom.com/search/2/search/lon.json?key=key&typeahead=true&limit=5&language=en-GB&minFuzzyLevel=1&maxFuzzyLevel=2’ from origin β€˜http://localhost’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.

Can you check the preflight (OPTIONS request) response?

1 Like