views:

607

answers:

1

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?

+1  A: 

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.

Eugene Morozov
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.
dr. evil
I didn't find any exception working with user credentials, but while looking for it, found nsIHttpAuthManager interface.
Eugene Morozov