How to handle windows authentication using C#, Selenium in newest Chrome version? - c#

In newest Chrome version I could not log in using https://user:pass#host/ trick. I have this warning message in console:
[Deprecation] Subresource requests whose URLs contain embedded credentials (e.g. https://user:pass#host/) are blocked. See https://www.chromestatus.com/feature/5669008342777856 for more details.
Anybody can help how to handle windows authentication using Selenium and C# in newest Chrome version?

This what worked for me as I have domain\username for the username authentication:
http://domain%5cusername:password#www.basicauthprotected.com
I got this syntax from here: https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/34#issuecomment-191403434
Also regarding the support of basic authentication in the URL for Chrome, it is back, and it seems that dropping it was a bug as reported by mkwst's comment here: https://bugs.chromium.org/p/chromium/issues/detail?id=435547#c33

Related

c# Selenium Try using a different browser. If you’re already using a supported browser, you can refresh your screen and try again to sign in

ChromeDriver drv1;
drv1 = new ChromeDriver(co);
drv1.Navigate().GoToUrl("https://accounts.google.com/signin");
i get this error when logging in google, I cannot log into any accounts.
Please help me
thank you so much
Try allowing less secured apps on your google account. Make sure you don't have 2-factor authentication enabled cause it won't work with that on. You can find this option here: https://myaccount.google.com/lesssecureapps

how can login to google account in c#? need sample

i try to login google account with c# windows app. but i have this error error
When I am trying to login via browser in my application it keeps saying "Couldn't sign you in" This browser or app may not be secure. i need sample
Google won't let you sign-in via an embedded browser for exactly the reason stated - it's not secure. To do so programmatically you need to use their API. Unfortunately this problem is far larger in scope than what an answer here on SO warrants, so here's some links:
Documentation on the .NET API (including samples) can be found here
More info on supported browsers and why this might not be one of them can be found here

Selenium WebDriver C# - Bypass Chrome Authentication Required dialog

I have an issue with Selenium WebDriver dealing with Google Chrome Authentication dialog box. I have search the net for 2 weeks but I can't get a definite solution to it.
I have a constraint, which is Selenium WebDriver will run in a remote Windows 2012 R2 server under user SYSTEM, hence running the background WITHOUT Chrome UI displayed.
Due to the constraint above, AutoIT doesn't works as it requires UI to handle the events. Driver.SwitchTo().Alert() doesn't seem to work too as it doesn't capture the alert at all (Some said it works on IE only).
Driver.Navigate().GoToUrl("https://username:password#url.com") doesn't work as well as my website is using SSO Login. It will first navigate to https://www.landingsite.com then redirected to https://authenticationrequired.com/daM2Sc, which the URL for the SSO Login is randomize every single time, so I couldn't bypass the Authentication dialog directly.
I wanted to use a workaround by capturing the authentication URL by using Driver.Url and the add my username and password infront of the URL, but then because of the prompted authentication dialog box, the driver fails to capture the URL and throws a timeout exception.
Some said by adding URL to trusted site would stop the dialog box being prompted but it doesn't work for some reason. It only works in IE.
Is there any other solution to this?
I lost a week to try do that, and when i can do, i think it's amazing. Java code here:
WebDriver driver = new ChromeDriver();
driver.get(user:pass#URL/);
and you must encode user and pass. Link encode: https://meyerweb.com/eric/tools/dencoder/
My chrome Version 65.0.3325.181 (Official Build) (64-bit)

Facebook OAuth Unable to Connect

I have been trying to create an iOS App using Xamarin (i.e. using Xamarin.iOS on C#) and I have run into an error I can't seem to resolve.
Basically, I have entered all the (correct) details into the default Facebook iOS SDK object as directed in the sample documents. However whenever I click login, the page returns 'unable to connect to server'.
The (URL Decoded) link the SDK sends me to is listed below:
https://m.facebook.com/v2.3/dialog/oauth?client_id=(ID-REDACTED)&default_audience=friends&display=touch&e2e={"init":REDACTED }&redirect_uri=fb-ID-REDACTED://authorize/&response_type=token,signed_request&return_scopes=true&scope=&sdk=ios&sdk_version=4.2.0&state={"REDACTED":"REDACTED= ","0_auth_logger_id":"REDACTED","com.facebook.sdk_client_state":true,"3_method":1}
Pointing to this in a browser returns me to a blank page (when I enter in my ID which I have removed from the link above). I'm pretty certain this is due to an error in the way I have set up my application on Facebook as opposed to an error with the SDK (I'm using the default provided by Xamarin). I have removed the app from Sandbox Mode as directed and I have tried to follow the instructions provided on a couple of forum posts but nothing has changed and I am at a loss right now...
Any advice?
Thanks!
Turns out I've managed to solve my issue...
For some really odd reason, m.facebook.com and facebook.com were added as entries in the hosts file (meaning that they were essentially blocked domains). This was weird given that I could access facebook from standard browsers like safari/firefox (just not the safari browser in the simulator).
If you have a similar issue, please change the hosts file (follow some tutorials online).

System.Windows.Forms.WebBrowser sometimes does NTLM auth - why?

I have a Windows Forms app targeting .NET 2.0. I'm attempting to add a single sign-on feature via the SAML 2.0 protocol, for which the most efficient apparent solution was an embedded web browser.
I've verified using a dummy app containing only a WebBrowser control that the NTLM exchange does take place. However, when I embed apparently the same control into the larger application, the browser doesn't respond to the initial HTTP 401 challenge and instead redirects to IE's "Navigation Canceled" page.
The Googles have not been forthcoming, and I'm puzzled at this behavior. Can anyone shed some light on what might be inhibiting the WebBrowser's credential negotiation?
I discovered the answer during a line-by-line comparison between the (working) test app and the (not working) full app.
The key to enabling NTLM negotiation for me was to set ScriptErrorsSuppressed to false. I had intended to hide Javascript error popups from our users, but suppressing those also suppresses credential negotiation. Go figure.

Categories