title: How to authenticate ngrok password automatically using Python and or Javascript?
body: <p>I am using ngrok to expose my localhost on a raspberry pi, and ngrok is password protected. I am using Django on another computer outside my network to access a webpage(simple server) on this raspberry pi. I don't want to manually type in the username and password to ngrok.</p>
  <p>How can I automatically fill in the ngrok user/password, which is a popup in chrome asking for user and password?</p>
  <p>What I've tried:
  I first tried using JS in my template, just using a fetch request:
  <code>https://user:password@myngrokdomain.ngrok.io</code> but chrome threw an error in the console saying I can't pass in credentials in plain text like this, rightfully so...</p>
  <p>I then tried to use python requests:</p>
  <pre><code>    UN= &quot;myuser&quot;
      PWD = &quot;mypassword&quot;
      loginURL = &quot;https://myngrokdomain.ngrok.io&quot;
      client = requests.session()
      login_data = dict(username=UN, password=PWD,)
      r = client.post(loginURL, data=login_data)
  </code></pre>
  <p>This returned a 401 access denied</p>
  <p><code>r.headers + r.reason</code> returns:
  <code>401 Unauthorized Unauthorized {'Content-Length': '16', 'Content-Type': 'text/plain', 'Www-Authenticate': 'Basic realm=&quot;ngrok&quot;', 'Date': 'Tue, 16 Mar 2021 15:22:15 GMT'}</code></p>