Password protected website (popup)


I want to make an app which will open a website inside the app. All code works fine with normal websites, but I also want to open a website which is protected by username and password. In normal browser (pc or smartphone) there will appear a popup to enter the username and password (Confirm by “OK” or cancel by “Cancel”).

In my app, it opens the URL but there is no popup where I can enter my username and password. It directly shows “401 Authorization Required”. This is the same message when you “cancel” the popup in normal browser.

How can I fix this and:

  1. make the popup visible?
  2. after that, is it possible to automatically sign in and remember the username and password?

Try this link

from the JavaScript Stunts FAQ

1 Like

I tried this solution, but ik doesn’t work… I think the “document.getElementById” is not working. How can I figure out the properties of the popup element?

Inspect in your browser - right click on the page and select Inspect, then look for the elements you need

Welkom Henk,

Weer een Nederlander die App Inventor gebruikt. Mooi.
Another Dutchman using App Inventor. Nice.

You could hardcode the username or password in the url. Which format you have to use i don't know.

Sometimes you can use this

Maybe show which website you want to exit and show what your url looks like.

If you want to save the username and password you can use a tinydb component.

you might want to read the Q&A section here App Inventor Tutorials and Examples: Inject | Pura Vida Apps

Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Hardcode the username and password doesn’t work.

Username and password were send by “Header - Authorization”. I found a tutorial with nearly the same issue: => “File Download from a Restricted Area”
I’m getting close, but can’t get the website shown in webviewer. I can add the Header Request in Web component, but when I open the URL within the webviewer compenent, it think it doesn’t do anything with the header request. The tutorial uses the header request for getting a image, but I want to show the website within webviewer component.
Can anyone explain to me how I could get the website ( showed in webviewer?

1 Like

as already mentioned by @Peter


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Hi All,

im also facing the same issue could you please help me to sort out my issue.

Mohamed Nazer

Sometimes websites ask for http login so you should try this: