MSAL - Angular universal ERROR BrowserAuthError: crypto_nonexistent: The crypto object or function is not available. Detail:Browser crypto, msCrypto, or msrCrypto interfaces not available.

Len Trinh 30 Reputation points
2023-05-29T17:19:28.9866667+00:00

Hi
I build the angular universal and MSAL B2C project and that has an error BrowserAuthError: crypto_nonexistent.
Thank you.

BrowserAuthError: crypto_nonexistent: The crypto object or function is not available. Detail:Browser crypto, msCrypto, or msrCrypto interfaces not available.

After run build:ssr and dev:ssr

"@azure/msal-angular": "^2.5.7",
"@azure/msal-browser": "2.37",
"@angular/core": "^15.0.2",
"@nguniversal/express-engine": "^15.2.1",
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,143 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,802 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rhaegar Cheng 5 Reputation points
    2025-01-10T06:10:26.48+00:00

    Wasting a lot of time searching solutions from internet, I fix the same issue on my own.

    The only thing you need to do is to use HTTPS instead of HTTP. MSAL only support HPPTS.

    It works in my scenario, and wish it helps.

    1 person found this answer helpful.
    0 comments No comments

  2. Chibuzor Nwankwo 0 Reputation points
    2024-11-24T16:40:59.9366667+00:00

    Any responses?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.