LogonUserA

[DllImport("Advapi32.dll", SetLastError = true)][return: MarshalAs(UnmanagedType.Bool)]
public static extern bool LogonUserA(
   string lpszUsername,
   string lpszDomain,
   string lpszPassword,
   uint dwLogonType,
   uint dwLogonProvider,
   out IntPtr phToken
);

Microsoft documentation: Link

Last updated