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

I need AJAX for my back-end server side, and I have found that it is about CORS. When I try unchecking the ‘Automatically create and login users’ option, it works but not auto like I said. Any suggestion would be appreciated.