Basic Authentication with CefSharp browser Control

2,126 views
Skip to first unread message

Deborah Brink

unread,
Jun 18, 2015, 9:17:50 PM6/18/15
to cefs...@googlegroups.com
I am trying to open a webpage in the CefSharp browser control that requires Basic Authentication. I already have the Username / Password saved in my system, so I do not want to display a popup asking for the authentication - in other words I do not want to handle GetAuthCredentials as I do not need to ask the user for their details.

Is there any way to add an "Authorization" header into the headers of the Request that gets sent to CefSharp, before it hits the website? I have tried SetHeaders() in OnBeforeResourceLoad but it does not seem to work as I'm still receiving an Unauthorized response back from the website.

Any suggestions welcome!

Alex Maitland

unread,
Jun 19, 2015, 12:09:16 AM6/19/15
to cefs...@googlegroups.com
I don't believe GetAuthCredentials invokes any sort of dialog by default. You have to implement that yourself if required. In your case, check the url matches the required site, simply set the username and password ref params and return true. The user doesn't have to be involved.

Is there any way to add an "Authorization" header into the headers of the Request that gets sent to CefSharp, before it hits the website? I have tried SetHeaders() in OnBeforeResourceLoad but it does not seem to work as I'm still receiving an Unauthorized response back from the website.

Stackoverflow is an excellent source of information, something like http://stackoverflow.com/questions/2716990/http-basic-authentication-credentials-passed-in-url-and-encryption may work.
Reply all
Reply to author
Forward
0 new messages