How to Fix SubtleCrypto: digest() undefined Error in Authgear SDK

Guide on how to fix SubtleCrypto: digest() non-HTTPS/Secure context Error in Authgear SDK

The Authgear SDK uses a browser API SubtleCrypto: digest() which requires HTTPS. As a result, if your client application that uses the SDK is on HTTP (non-secure), you may run into the SubtleCrypto: digest() non-HTTPS/secure context error.

To use the SDK, your client application must be on HTTPS or be running in secure contexts. Secure contexts include running your application from localhost or

The following are examples of the error messages you will get SubtleCrypto: digest() non-HTTPS/secure context error in Chrome and Firefox.


  "stack": "TypeError: Cannot read properties of undefined (reading 'digest')\n    at\n    at p (\n    at o._invoke (\n    at (\n    at e_ (\n    at i (\n    at\n    at new Promise (<anonymous>)\n    at\n    at iz (",
  "message": "Cannot read properties of undefined (reading 'digest')"


  "fileName": "",
  "lineNumber": 1,
  "columnNumber": 219125,
  "message": "window.crypto.subtle is undefined"


The following are ways to fix the SubtleCrypto: digest() non-HTTPS/secure context error:

  • If you need to run your application on a local environment or for testing where you can't set up HTTPS, consider running your application in secure contexts, For example, http://localhost or

  • To run your application from another domain other than a localhost, set up HTTPS on the domain.

You can learn more about SubtleCrypto: digest() and Secure Contexts see the pages linked below:

Last updated