GetAuthCredentials works only once

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.

Re: GetAuthCredentials works only once

Postby ndesktop » Fri Sep 10, 2021 12:52 am

I see CefSharp noticed this as well and their solution - until a fix in CEF - is to pass a noop completion callback.
Probably in CEF the fix should be in CefRequestContextImpl::ClearHttpAuthCredentialsInternal by adding something like this
Code: Select all
void CefRequestContextImpl::ClearHttpAuthCredentialsInternal(
    CefRefPtr<CefCompletionCallback> callback,
    CefBrowserContext::Getter browser_context_getter) {
  auto browser_context = browser_context_getter.Run();
  if (!browser_context)
    return;

  browser_context->GetNetworkContext()->ClearHttpAuthCache(
      /*start_time=*/base::Time(), /*end_time=*/base::Time::Max(),
      base::BindOnce(&CefCompletionCallback::OnComplete,
          callback ? callback : base::NullCallback()));  <== this
}


Maybe some control on start_time and end_time will be required, but this is something else.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: GetAuthCredentials works only once

Postby ndesktop » Fri Sep 10, 2021 2:54 am

pdooker wrote:Has anyone been able to successfully use ClearHttpAuthCredentials?

I keep getting a crash when I call it.

Is there an issue filed for this crash? I can try a PR to fix it to make it available into upstream.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: GetAuthCredentials works only once

Postby pdooker » Mon Sep 13, 2021 11:09 am

Any help would be appreciated.
pdooker
Techie
 
Posts: 18
Joined: Fri Apr 21, 2017 12:16 pm

Re: GetAuthCredentials works only once

Postby pdooker » Mon Sep 13, 2021 1:27 pm

Oh sorry! I did not see your replies ndesktop!

I have not filed a case nor have I come across any cases in regards to this issue.

Thanks for the help! I will try and pass in a callback.
pdooker
Techie
 
Posts: 18
Joined: Fri Apr 21, 2017 12:16 pm

Re: GetAuthCredentials works only once

Postby pdooker » Wed Sep 15, 2021 12:40 pm

Thanks ndesktop, the solution to provide a non-null callback worked.

The documentation says this:

Code: Select all
public virtual void ClearHttpAuthCredentials( CefRefPtr< CefCompletionCallback > callback )= 0;

Clears all HTTP authentication credentials that were added as part of handling GetAuthCredentials. If |callback| is non-NULL it will be executed on the UI thread after completion.

Which is obviously not right.
pdooker
Techie
 
Posts: 18
Joined: Fri Apr 21, 2017 12:16 pm

Re: GetAuthCredentials works only once

Postby ndesktop » Thu Sep 16, 2021 1:41 am

Yes, that is why I suggested to create an issue to someone (myself included) can submit a PR for the null callback case.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Previous

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 50 guests