I am using below code to connect to SPO from powershell, but we have multi factor authentication in SharePoint.
So I want to give credentials from browser instead of script. Please suggest as i dont want to use PnP and Connect-SPOService due to environment restrictions.
{
$ctx=New-Object Microsoft.Sharepoint.Client.ClientContext($webUrl)
$ctx.Credentials=New-Object Microsoft.Sharepoint.Client.SharePointOnlineCredentials($userName,$password)
return $ctx
}