microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
512 stars 285 forks source link

MFA secret key issue #1414

Open DotaABhash opened 3 months ago

DotaABhash commented 3 months ago

@Shakevg can you please help me out on this... thankyou I was trying to bypass MFA in one of my CRM application using the secret key, I did everything right the steps ask to, but it seems to be stuck on the OTP screen can you please help me out .... image image

Shakevg commented 3 months ago

Framework doesn't support such a method with push notification. But the workaround may be (It will require some code update, you can do it locally):

  1. Click 'I can't use my Microsoft Authenticator app right now' link
  2. Select 'Use a verification code' image
  3. Type code
DotaABhash commented 3 months ago

thankyou @Shakevg i changed it to verification code and it is working fine now. Also, i have this issue while delete a Lead it gives out an error indicating it cannot find the element. Is it xpath issue ? i tried using the xpath inspecting the browser but did not find a match, so i tried my own xpath and still got the same error. Can you plz help me out on this as well .... thankyou [my xpath: //div[@class='ms-StackItem truncatableText-409']] Message:  Test method Microsoft.Dynamics365.UIAutomation.Sample.UCI.UpdateLeadUCI.UCITestUpdateActiveLead threw exception: OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@tabindex='0' and @role='checkbox']"} (Session info: MicrosoftEdge=123.0.2420.53)

Stack Trace:  BrowserCommand1.Execute[T1,T2,T3,T4,T5,T6,T7,T8,T9](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9) line 140 BrowserCommand1.Execute(IWebDriver driver) line 35 BrowserPage.Execute[TResult](BrowserCommandOptions options, Func`2 delegate) line 182 WebClient.OpenRecord(Int32 index, Int32 thinkTime, Boolean checkRecord) line 1535 Grid.OpenRecord(Int32 index) line 32 UpdateLeadUCI.UCITestUpdateActiveLead() line 35 image image

Shakevg commented 3 months ago

DotaABhash Are you using develop branch?

DotaABhash commented 3 months ago

@Shakevg yes i am using develop branch...

NikitaShah24 commented 1 month ago

@Shakevg will you please help with this? I was trying to bypass MFA in one of my CRM application using the secret key, I did everything right the steps ask to, but it seems to be stuck on the OTP screen can you please help me out ....

I get this screen even though I have added my mfasecret key in app.config file.

image

and my app.config file looks like this

image

and here is the code for that

public void Login(Uri orgUrl, SecureString username, SecureString password, SecureString mfaSecretKey) { var otpKeyStr = "6jm7n6xwitpjooh7ihewyyzeux7aqmw2"; SecureString sec_pass = new SecureString(); Array.ForEach(otpKeyStr.ToArray(), sec_pass.AppendChar); sec_pass.MakeReadOnly(); var otpKeyBytes = Base32Encoding.ToBytes(otpKeyStr); var otp = new Totp(otpKeyBytes); var twoFactorCode = otp.ComputeTotp().ToSecureString(); // <- got 2FA coed at this time! LoginResult result = _client.Login(orgUrl, username, password, twoFactorCode); if(result == LoginResult.Failure) throw new InvalidOperationException("Login Failure, please check your configuration");

 _client.InitializeModes();

}

Shakevg commented 1 month ago

I see there is no link "'I can't use my Microsoft Authenticator app right now' link" on screen.

NikitaShah24 Can you change MFA method from push to code in MS account settings? What app do you use for MFA? Can you change it to MS authenticator?

NikitaShah24 commented 1 month ago

Hello @Shakevg I am using microsoft authenticator but in my options there is no code option I can choose. The only options I have is, phone or app authenticator.

Shakevg commented 1 month ago

I suppose it is not possible to login using EasyRepro on this case