badgateway / oauth2-client

OAuth2 client for Node and browsers
https://www.npmjs.com/package/@badgateway/oauth2-client
MIT License
269 stars 31 forks source link

Handle case where SubtleCrypto is not available #144

Open fzakfeld opened 2 months ago

fzakfeld commented 2 months ago

SubtleCrypto required a secure origin (e.g. https, localhost) in most browsers. While testing I ran in to an issue where SubtleCrypto was not available.

Currently this error is being thrown:

TypeError: r2(...).createHash is not a function

This might be an edge case as most testing happens on localhost, and production is hopefully always https, but I think the library should handle this - at least with a usable error.

evert commented 2 months ago

Great point! We could do with a nicer error here