OAuth 2.0 Auth Automation Script error Not allowed to Launch because a user gesture is required
Hi,
I am getting a Automation script error in the OAuth 2.0 Auth Manager. I have a customer facing API that requires a login with a valid username and password (and an OTP but this can be disabled)
I am currently getting one of 2 errors. If I have a valid client details and I disable the OTP for the user, the script fails with the following error:
The following script failed: {{code of the scipt}}
Page URL: {{the_callback_url-with_code_token}}
Error: Not allowed to launch
'{{the_callback_url-with_code_token}}'
because a user gesture is required.
and when I try with a user with an OTP I get the following error
"the scheme does not have a registered handler."
Edit: one more minor note I forgot to mention prior, is for the OTP , I have not coded out the script to enter in the otp so I am manually keying in the value of the OTP when the screen appears. not sure if doing this manually is causing the different error
below are are the settings for the Auth Repo Get Access Token section
within the automation script section of the Auth Manager I have pages of automation
you can view the flow of the login after the code below)
the first page is actually blank as whenever I put the code in the first block it never seems to be executed.
the second page has the code below
var a = 0;
var b = 0;
var varUsername = {{usernamestringfortest}} ;
var varPassword = {{passwordstringfortest}};
var varOTP = 0;
setTimeout( 2000);// This function waits for the login field:
function waitForLoginPanel() {
if (document.querySelector("#centerPanel").querySelector("#emailId-17")) {
EnterLoginDetails();
} else {
if (a++ < 10) {
setTimeout(waitForLoginPanel, 1500);
}
}
}
// This function enters the login and clicks the login button:
function EnterLoginDetails() {
document.querySelector("#centerPanel").getElementsByClassName("slds-input")[0].value = varUsername ;
setTimeout( 100);
clickContinueButtonForUserField();
}// This function clicks the Continue button after entering a username:
function clickContinueButtonForUserField() {
var loginButton = document.querySelector("#centerPanel").getElementsByTagName("button")[0];
var initialOpacity = getComputedStyle(loginButton).getPropertyValue("opacity");
if (parseFloat(initialOpacity) !== 0.4) {
loginButton.click();
setTimeout( waitForPasswordField, 1500);
} else {
if (b++ < 10) {
setTimeout(clickContinueButtonForUserField, 1500);
}
}
}// This function enters the password and clicks the login button:
function EnterPasswordValue() {
document.querySelector("#centerPanel").getElementsByClassName("slds-input")[0].value = varPassword ;
clickloginbutton();
}
// This function clicks the second login button:
function clickloginbutton() {
var loginButton = document.querySelector("#centerPanel").getElementsByTagName("button")[1];
if (loginButton) {
var initialOpacity = getComputedStyle(loginButton).getPropertyValue("opacity");if (parseFloat(initialOpacity) !== 0.4) {
loginButton.click();
}else {
setTimeout(clickloginbutton, 1500);
}
}
}// This function waits for the password field:
function waitForPasswordField() {
if (document.querySelector("#centerPanel").querySelector("#input-23")) {
EnterPasswordValue();
} else {
if (a++ < 5) {
setTimeout(waitForPasswordField, 2000);
}
}
}
// TO BE COMPLETED This function waits for the OTP field and key it in:
//function waitForOTPField() {
// if (document.querySelector("#centerPanel").querySelector("????")) {
// EnterOTPValue();
// } else {
// if (a++ < 5) {
// setTimeout(waitForOTPField, 2000);
// }
// }
//}
// This function enters the password and clicks the login button:
//function EnterPasswordValue() {
// document.querySelector("#centerPanel").getElementsByClassName("????")[0].value = varOTP ;
//
//}
// Start the login process
setTimeout(waitForLoginPanel, 2000);
so you can see the flow below and one of the errors seen
any assistance in fixing this would get great