Wordpress User Migration: Unexpected Token < at position 0

Hello,

We use the Auth0 WordPress plugin to provide auth services to our users. Recently, with no changes done to our environment, new users are no longer able to sign in to our application because the User database migration is not working.

The following error is created: “SyntaxError: Unexpected token < in JSON at position 0”

I was able to track this error down to our custom DB login script/action. The script tries to JSON parse the content of the response body, but it seems that the response is being returned as HTML instead of JSON.

<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="robots" content="noindex,nofollow">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet">


</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">
Enable JavaScript and cookies to continue
</span>
</div>
</div>
</noscript>
<div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=7d32cdabfd4b10b2')"></div>
<form id="challenge-form" action="/index.php?a0_action=migration-ws-login&amp;__cf_chl_f_tk=XS_Eoylw1ThHQorUg6ZmncUjS57Zh8rCO1.DA.uv9Yo-1686077032-0-gaNycGzNC9A" method="POST" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="md" value="q7hr9CMJ12eoudxZGkhOZnngQPEiCAJ6sFSUdSVoKiI-1686077032-0-Af7Rr4w9oLgUjgDD_49btby2Nfik81z822JFbxmjCiNuqgrThVUUrMPUu4SU-BT6wMzfv2n2n7b7E2epS7rEK93DKj8HqHlW1Uoy-F1abN6IKT9z3osuwUZLjVPyGLqqOxzk77hGnWQAiQXsGm_CnyvoInlk0GjpFQw2AAGkD_6j2gWChZZsSmJ0oE6ENW9hPpaJNFRRpU8ddfWCqoknzntNjkfketqWXNfMu8dWZ5phJrS02uKUwvrmSgUWcfuYqb12hK8s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9BY2BCW7lqwNp_JxSQJ8WNo93wWw6hJxr7vx5pqrkyAKRAReAi2KaPblAzk4c2IZjBOyHTCwIz-k4q2ricFKJ1ABFFWbBjMRUwBQUal16ft8GYbXb9OM0-plKbyLm8rd2IYYLFwfHOJN1FOuN0q5j33AuDX36qLFVEqBBeVyiw9-qEH6wzGSf4n9axKZs8ZCQBROikItrV3ylsE2djk8FAfIl-uH4zPeaaXN0vBwLmNzoDHI8HqfkgVU4hCNJOugkE0rk3e0OOtYHg8C5Z3ScTlCddBmfE6GAAC2DB6UlRWKsBpSZebzu6bHrER6AkMUgqZBMoy11DaDExf7MRgw3Tc6pcBBukl4mwFlVpZMXLi-aOARKobJJgUHmZCJjL1OD5ZdS_3ehrgmAfgCFHakMCyaUZ0yYMRrH9RYgWkxo6KB703QYfvcapq-xtSvD5SWC3YR9s7_OjSW-xKwUYTayj3IETENyGPvnurArjpMQL8nIaCWGLoW-kl2MQSOXFhrNgvo2foXN8Df_h52REpFOTiACo">
</form>
</div>
</div>
<script>
(function(){
window._cf_chl_opt={
cvId: '2',
cZone: 'new.ifgsd.com',
cType: 'managed',
cNounce: '95339',
cRay: '7d32cdabfd4b10b2',
cHash: '01ccb7826d89d10',
cUPMDTk: "\/index.php?a0_action=migration-ws-login&__cf_chl_tk=XS_Eoylw1ThHQorUg6ZmncUjS57Zh8rCO1.DA.uv9Yo-1686077032-0-gaNycGzNC9A",
cFPWv: 'g',
cTTimeMs: '1000',
cMTimeMs: '0',
cTplV: 5,
cTplB: 'cf',
cK: "",
cRq: {
ru: 'aHR0cHM6Ly9uZXcuaWZnc2QuY29tL2luZGV4LnBocD9hMF9hY3Rpb249bWlncmF0aW9uLXdzLWxvZ2lu',
ra: 'Tk9fVUE=',
rm: 'UE9TVA==',
d: '/V+/wpni88cENoT9DcL9lNmmDb72vRqZ7S68U5o/o3ICiDZ8oXRLVL8otxntcN9N6BnWuV9Z6ms/CmkxsskyoWen3byyLkI7hakDOvBmdyphpK3lECPC+utgYi36tdT4nMDsTo/OXNllSrFsf+f9Ysy3fXMgOO+y8jrlC2Q0o1mIrG2nVcNogGzfmowbUD8MVwJN1//X3om7r+Ab/a6kht6+W/2wqXEleaQ11y23/N/ZlUDC6i4goxzmrQYtFZN0uSuZcx1xpnBD75NNkLgOwrsvT2ROqfjmbl597cKSf4w1dpwUcrACggtVDIN+EXTLg2BJEx8XC/fkSZReRZAnGbilQqLXtaeW17iTbfnyamhD2834ys4Z2QEoNd8h52HQFarp6nN/wGf17PqDT6HCrv+OLupVqlwxamjn0xcont40jJ0VMVsHXz9WJjO5gdlLk6hxBZOalJ1T+Is6o4JQ3nttbfMb5Sr9OD3Dl3HKAbGUcBB4/QJjOx8uDjRXgUITcBrwtJxW/YmJ99V4VD2OpAEDV1UpSlDIF4kIDt1cUZjr3HGF+bRjzA30d5r84oQ+4flxpLO2xi0W6Rh4ag1pV6FckWpi64ohcldveMF69pl3HkygNkyTnG4O/BNVRuLD',
t: 'MTY4NjA3NzAzMi4zMTIwMDA=',
m: 'FIc1rtpD4rXvguplfvCB8khz2w8oc2bjQ8ZbFSPnUv4=',
i1: '7tRLsPkUIF8kZrol6hX4dw==',
i2: 'HkonQoIFTdy4SJyJ28JwuA==',
zh: 'nXNVTM7kECiMs3JiGToYx3SL7fjzcRtjyLNzsEBD5xg=',
uh: 'DV4j3Tmrbi5Rs1q3ahwVS6SgbPbI7np5884QO1u1Cgg=',
hh: 'hLIAayA0sroJn1D3Rgwa+ZL3dIEYh/UssbcrEmfXrOo=',
}
};
var trkjs = document.createElement('img');
trkjs.setAttribute('src', '/cdn-cgi/images/trace/managed/js/transparent.gif?ray=7d32cdabfd4b10b2');
trkjs.setAttribute('alt', '');
trkjs.setAttribute('style', 'display: none');
document.body.appendChild(trkjs);
var cpo = document.createElement('script');
cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/managed/v1?ray=7d32cdabfd4b10b2';
window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;
window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, location.href.length - window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;
if (window.history && window.history.replaceState) {
var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;
history.replaceState(null, null, "\/index.php?a0_action=migration-ws-login&__cf_chl_rt_tk=XS_Eoylw1ThHQorUg6ZmncUjS57Zh8rCO1.DA.uv9Yo-1686077032-0-gaNycGzNC9A" + window._cf_chl_opt.cOgUHash);
cpo.onload = function() {
history.replaceState(null, null, ogU);
};
}
document.getElementsByTagName('head')[0].appendChild(cpo);
}());
</script>


</body>
</html>

because of this it seems that the user is not able to be created on the Auth0 platform and thus causes a failure message during login for our new users.

I have found this thread that is 90% the same issue that we are having but unfortunately no detailed explanation of the solution is given here: Sign ups not working with custom Wordpress database connection - #4 by peter.fernandez

Does anyone have any ideas what may be going on? I’ve troubleshooted using the documentation already for this error message but I have confirmed that the endpointUrl is correct and I have checked with our host, WpEngine, and had them exclude these endpoints from cache as instructed in documentation.

Hi @agarcia,

Have you been able to solve the issue?

The issue is not resolved for us as well but at last we have identified what caused and have a temporary fix in place. Our server was not getting the response for /index.php?a0_action=migration-ws-get-user endpoint because Cloudflare, used by our hosting WP Engine, was preventing the request to go through. And apparently the reason for that is the request doesn’t have any User Agent information. We’re able to add an exclusion rule for 90 days and postpone the problem but the time is running out.

I’ve created an issue here. Auth0 needs to help us figure out a solution here.

I also see in logs this error sometimes 1-2 in week… What is issue of it ?