--- title: "NTLM認証に対応する方法" slug: "how-to-handle-ntlm-authentication" updated: 2025-11-25T06:27:52Z published: 2025-11-25T06:27:52Z canonical: "helpcenter.autify.com/how-to-handle-ntlm-authentication" --- > ## Documentation Index > Fetch the complete documentation index at: https://helpcenter.autify.com/llms.txt > Use this file to discover all available pages before exploring further. # NTLM認証に対応する方法 このページでは、NTLM認証を使用するWebサイトをテストする際の対応方法についてご説明します。 ## 設定方法 (Playwrightコードステップ) NTLM認証を通過するには、シナリオの**先頭**にPlaywrightコードステップを追加し、Chrome DevTools Protocol (CDP) を介して認証情報を自動的に提供するよう設定します。 以下のコードをPlaywrightコードステップとして追加してください。 ```typescript const username = "username" const password = "password" const cdp = await context.newCDPSession(page) cdp.on("Fetch.requestPaused", ({ requestId }) =>  cdp.send("Fetch.continueRequest", { requestId }) ) cdp.on("Fetch.authRequired", ({ requestId }) => {  cdp.send("Fetch.continueWithAuth", {    requestId,    authChallengeResponse: {      response: "ProvideCredentials",      username,      password    }  }) }) await cdp.send("Fetch.enable", { handleAuthRequests: true }) ``` コード内の1行目と2行目にある `username` と `password` を、お客様が指定する実際のユーザー名とパスワードに置き換えてください。 ## 注意点・制約事項 > **ユーザー名にバックスラッシュ (\)**が含まれる場合 (例: `DOMAIN\user`)、コード上では `\\` (バックスラッシュを2つ) のようにエスケープして記述する必要があります。 > > (例: `const username = "DOMAIN\\user"` ) - **認証情報の適用範囲:** このコードステップで設定された1組のユーザー名とパスワードは、そのシナリオ実行中に発生する**全て**のNTLM認証プロンプトに対して自動的に使用されます。 - **文字表示(日本語Windows環境):** 一部の日本語Windows環境では、Playwrightコードエディタ上でバックスラッシュ `\` が円記号 `¥` として表示される場合がありますが、動作に影響はありません。