Hello,
I am Migrating users from Okta to Auth0 following the steps in Auth0 docs.
However, after setting up the login and get user script i am getting an error when trying to login after clicking on “Try Connection”.Attached is the screenshot of the error page and the Login Script i used.
On the logs i can see the error description as “error unhandled”
Can anyone please suggest anything?
Login Script
function login (email, password, callback) {
var url = 'https:/{my_okta_tenant}/api/v1/authn';
request({
url: url,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: {
username: email,
password: password,
options: {
multiOptionalFactorEnroll: false,
warnBeforePasswordExpired: false
}
},
json: true
}, function (error, response, body) {
// Ensure we have a successful response
if (response.statusCode !== 200) return callback();
// Get the user from the response body
var user = body._embedded.user;
// Set the data we want to store in Auth0 and migrate the user
return callback(null, {
user_id : user.id,
username: user.profile.login,
email: user.profile.login,
// We set the users email_verified to true as we assume if they were a valid
// user in Okta, they have already verified their email
// If this field is not set, the user will get an email asking them to verify
// their account
email_verified: true,
name: user.profile.firstName + ' ' + user.profile.lastName
});
});
}
Thanks in advance
Aafreen