Dusk : Login to a site secured with HTTP Authentication.

If you are using Laravel Dusk to test an external website and if the website is secured with basic HTTP Authentication (which is usually the case with staging and dev sites) you can use this trick.

Http Authentication

Append the username and password just before the url

'http://UserName:Password@www.example.com'

So in dusk you can visit the URL by

Livewire Component Library
$browser->visit('http://UserName:Password@www.example.com')

Or you can set the APP_URL in the .env file directly.

Host Laravel Application on DigitalOcean

Use coupon 5balloons on this Cloudways Affiliate URL to get special discount.
APP_ENV = http://UserName:Password@www.example.com

This way, the website won’t prompt with a javascript alert box for the login details and will directly log you into the website.

Site Footer