angular-auth-oidc-client Cannot read properties of undefined (reading 'digest')

731 Views Asked by At

I set up an angular oidc client for an angular application and deployed to an ec2 machine. Even if the authentication works fine on local machine, on the ec2 machine I receive the following error in the console: ERROR TypeError: Cannot read properties of undefined (reading 'digest'). I understood that is related to the fact that in runs in an unsecure environment. Is there a way to fix this error?

1

There are 1 best solutions below

2
Lonli-Lokli On

The error is cased by the unsafe environment since webcrypto is not available, it you are hosting via HTTP, not https (or your certificate is invalid)

In Chrome secure origin are the ones that match the following (scheme, host, port) patterns:

(https, *, *) - HTTPS (wss, *, ) - Web Socket Secure (, localhost, ) - localhost (, 127/8, ) - IPv4 loopback (, :: 1/128, *) - IPv6 loopback