Setting/deleting/changing cookies upon request

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: Setting/deleting/changing cookies upon request

Postby magreenblatt » Tue Jun 21, 2022 6:13 am

If the CEF browser sent a request with my modified cookies

You should verify that for yourself by looking at what was sent over the wire.

then how does the server identify and authorize this request if I changed the cookies

Any number of ways. https://pixelprivacy.com/resources/brow ... rprinting/
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Setting/deleting/changing cookies upon request

Postby johannnovaksh » Mon Nov 14, 2022 4:46 am

Hello,

I'm currently working on a project using CEF and I stumbled upon the same kind of issue.

In my case, I try to add a new header parameter to the request (an authorization header with a Bearer token) before processing the ressource.
I added a custom client in the method 'CefBrowserHost::CreateBrowserSync' which is able to return a custom 'CefResourceRequestHandler' whose method 'OnBeforeResourceLoad' is overriden.

I can break inside the method (so the pipeline is working as expected), and the request HeaderMap is updated with my new header.

Code: Select all
   ReturnValue OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
                                 CefRefPtr<CefFrame> frame,
                                 CefRefPtr<CefRequest> request,
                                 CefRefPtr<CefCallback> callback) override
   {
      CefRequest::HeaderMap map;
      request->GetHeaderMap(map);
      map.insert({CefString("Authorization"), CefString("Bearer xxxxxxxxxxxx")});
      request->SetHeaderMap(map);

      return RV_CONTINUE;
   }


However, when I catch the request headers server-side, my 'Authorization' header parameter is not inside the map, hence my unauthenticated client.

Is there any way to check the final state of the request just before it is sent ?
johannnovaksh
Newbie
 
Posts: 1
Joined: Mon Nov 14, 2022 4:34 am

Previous

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 48 guests