-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question]Playwright in Kerberos environment #1730
Comments
I just managed to get it working. You need to set the following Chrome policies: What OS are you working on? I have some additional tips if you are working on a Mac. Related #1707 |
I'm working on Windows. Is there any way to set these policies in my playwright framework (on index.js or some other file?). I actually don't have admin rights to my system, so can't set policy values from chrome://policy. |
It is possible to set the first two policies using args like this: const browser = await chromium.launch({
headless: false,
args: [
"--auth-negotiate-delegate-whitelist=*.domain.com",
"--auth-server-whitelist=*.domain.com",
],
});
const context = await browser.newContext();
const page = await context.newPage(); You need to replace domain.com with the domain you're logging on to. But not the third (AmbientAuthenticationInPrivateModesEnabled), as far as I know. |
Thanks for the prompt reply. Seems like I'm making some progress. I added the two flags and got AmbientAuthenticationInPrivateModesEnabled added as well (value: 0x0000true). Now when I run my script, I get Error: net::ERR_INVALID_AUTH_CREDENTIALS at https://*.com. Any idea, how to fix it? |
I'm able to fix this error by using context.setHTTPCredentials(). This also gets rid of one login prompt. But the second one is still there. This application which is generally an SSO app has two level of login prompts with playwright. |
Can you run the chromium instance and check the chrome://policy page? Im esp. interested in the AmbientAuthenticationInPrivateModesEnabled policy. it should be an integer (0-4) and not a boolean. You can also try running with a persistentcontext (https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypelaunchpersistentcontextuserdatadir-options). Then you don't need this policy, however you can't run multiple contexts in parallel with a persistent context. |
Closing this since there hasn't been much activity here. |
Leaving a comment here in case anyone might still be wrestling with this.
browser = p.chromium.launch( headless=True, args=[
"--auth-negotiate-delegate-allowlist=*.example.com",
"--auth-server-allowlist=*.example.com",
"--start-maximized"
] ); |
Encountering this issue with Chrome in 2023 on a Linux Gitlab runner, any suggestions? |
I am trying to make in work in a Linux container (with RobotFramework, based on latest playwright image)... no luck for now. I am even not sure about the way to set those policy settings. What is the correct way to allow this Kerberos auth. to work ? {
"AmbientAuthenticationInPrivateModesEnabled": 3,
"AuthServerAllowlist": "*.mysubdomain.mydomain.com,*.mydomain.com",
"AuthNegotiateDelegateAllowlist": "*.mysubdomain.mydomain.com,*.mydomain.com"
} Has anyone manage to implement Kerberos authentication with playwright (+ RobotFramework maybe). This is a blocker for me as I have many apps to test with Windows Integrated Autehntication (Kerberos only, no NTLM). |
@aloene these works in my case: with sync_playwright() as p:
browser = p.chromium.launch( headless=True, args=[
"--auth-negotiate-delegate-allowlist=*.mydomain.com",
"--auth-server-allowlist=*.mydomain.com",
"--start-maximized"
] ); |
OK, thanks for your answser @paoloantinori. I do not understand what is wrong... Do you use Windows or Linux/Linux Container ? Have you changed/set any other setting somewhere ? |
Also, how do you choose credential to be used ? Current process identity or do you explicitly use test credential from your test code ? |
This question might be leading to the issue. This configuration enables Chromium to use a valid Kerberos token already available to the user ( of the operating system) In my case I do take care of getting one from the command line. I use |
Ok. Thanks. |
This actually works with current/"old" headless chromium (ie. shell). This does not work with chromium channel (the one I was trying to use). I also removed httpCredentials arg as the Kerberos ticket is enough. Thanks ! |
We have an internal site that requires kerberos authentication. How do I make Playwright work in such scenario?
The text was updated successfully, but these errors were encountered: