Wednesday, April 13, 2011

How to get Basic Authentication Information in a Firefox Extension?

I'm coding a Firefox extension and want to get Basic Authentication information for a website (or for the current document).

How can I get Basic Authentication Information in a Firefox Extension?

From stackoverflow
  • I couldn't find an exact answer and don't have time to experiment now, but it seems that the only way is to manually examine headers using NsIHttpChannel.

    EDIT: Ok, I've found nsIHttpAuthManager:

    This service provides access to cached HTTP authentication user credentials (domain, username, password) for sites visited during the current browser session.

    Looks like exactly what you need.

    dr. evil : I assume for this I have to carry out a test request, but it should be already in Firefox's memory. I'm trying to avoid extra requests actually.
    Eugene Morozov : I didn't find any exception working with user credentials, but while looking for it, found nsIHttpAuthManager interface.

0 comments:

Post a Comment