Hello.
I’m receiving an error when signing up new users via custom database.
Login by Auth0 plugin v. 4.3.1
Through testing and troubleshooting, I ended up at the setting for our custom database and following these steps: User Migration in Login by Auth0 WordPress Plugin
When I ‘Save and Try’ the Login Script, I receive "Unexpected token < in JSON at position 0"
I tried to confirm my script was correct, but the link in the doc ( https://raw.githubusercontent.com/auth0/wp-auth0/master/lib/scripts-js/db-login.js) is no longer available.
Here is my script:
function login (email, password, callback) {
var request = require("request");
request.post(configuration.endpointUrl, {
form:{username:email, password:password, access_token:configuration.migrationToken},
}, function(error, response, body){
if ( error ) {
return callback(error);
}
var info = JSON.parse(body);
if (info.error) {
callback();
} else {
var profile = {
user_id: info.data.ID,
username: info.data.user_login,
email_verified: true,
email: info.data.user_email,
name: info.data.display_name
};
callback(null, profile);
}
});
}```
I followed the troubleshooting steps on that doc:
- My endpoint as site_url/index.php?a0_action= loads a page of random posts on my site.
- My endpoint as site_url/index.php?a0_action=migration-ws-login returns {“status”:401,“error”:“Unauthorized”}
- If I add
callback(null, configuration);
to the function, the return is"Returned user does not have an expected user_id value. If your Database Connection has enabled the \"Use my own database\" option, please make sure to return this attribute from the Login script."
- I’ve confirmed with my host that the endpoint is not cached.
- Do you see any error in the script?
- How else can I troubleshoot the
"Unexpected token < in JSON at position 0"
error?
Thank you very much