Use MSAL from CEF3 application (may require https)

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.

Use MSAL from CEF3 application (may require https)

Postby natonicfp » Tue Mar 23, 2021 9:16 am

I am trying to build an application that needs to authenticate to Azure AD using Microsoft's MSAL.js library (https://github.com/AzureAD/microsoft-au ... al-browser). I have been using the cefclient example as my starting point. I have a very basic page that successfully redirects to my Azure AD authentication server on a regular browser. When I include that page in my cefclient resources and visit it from there, the redirect fails with
Code: Select all
"The PKCE code challenge and verifier could not be generated.  Detail: TypeError: Cannot read property 'digest' of undefined..."
.

In researching this further it appears the issue is that this part of the MSAL auth process needs to use WebCrypto to generate the PKCE code, and is not able to because Chromium only allows WebCrypto calls from a secure origin: https://chromium.googlesource.com/chrom ... page_loads. A potentially easy fix would be to use the file:/// scheme to load my page, but unfortunately, MSAL doesn't allow tokens to be returned to file:/// pages. I've also tried using file:/// to initiate the auth request, and having MSAL redirect to my http page, but MSAL doesn't like that either.

Is anyone successfully loading CEF3 resources with the https:// scheme? Any examples you can point me to?
natonicfp
Techie
 
Posts: 20
Joined: Mon Mar 22, 2021 4:16 pm

Re: Use MSAL from CEF3 application (may require https)

Postby magreenblatt » Tue Mar 23, 2021 9:19 am

Yes, you can use the HTTPS scheme. See https://bitbucket.org/chromiumembedded/ ... t-handling
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Use MSAL from CEF3 application (may require https)

Postby natonicfp » Tue Mar 23, 2021 9:24 am

Thanks! I tried searching for something like that. Not sure how I missed it. I'll play with this. I appreciate the quick reply.
natonicfp
Techie
 
Posts: 20
Joined: Mon Mar 22, 2021 4:16 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 66 guests