Handling HTTP Authentication Failure

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Handling HTTP Authentication Failure

Postby mattdol » Thu Aug 31, 2017 12:56 pm

Hello,

I've been using the CefRequestHandler::GetAuthCredentials method and the CefAuthCallback object in order to login to HTTP Auth sites through CEF. Since the CefAuthCallback::Continue method has no return type (void), I was wondering how people are handling a failed HTTP Auth login attempt.

Thanks!
mattdol
Newbie
 
Posts: 6
Joined: Fri Jan 27, 2017 4:46 pm

Re: Handling HTTP Authentication Failure

Postby magreenblatt » Thu Aug 31, 2017 2:21 pm

Authentication failure should result in a call to CefLoadHandler::OnLoadError.
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: Handling HTTP Authentication Failure

Postby mattdol » Wed Sep 06, 2017 12:20 pm

CefLoadHandler::OnLoadError is not catching the 401 error that is occurring when trying to access HTTP Auth sites without submitting credentials. I have verified on Chrome (using the Dev Tools) that there is a 401 status occurring on the sites I'm working with. Would CefNavigationEntry::GetHttpStatusCode be the correct method to implement to handle this, or is there a different/better way to catch 401 errors?
mattdol
Newbie
 
Posts: 6
Joined: Fri Jan 27, 2017 4:46 pm

Re: Handling HTTP Authentication Failure

Postby magreenblatt » Wed Sep 06, 2017 12:32 pm

Right, it's not really a load error since the website is returning a displayable result. Try if response->GetStatus() in CefRequestHandler::OnResourceResponse or OnResourceLoadComplete reports the 401 error code.
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 33 guests