Clever / saml2

Node module to abstract away the complexities of the SAML protocol behind an easy to use interface.
Apache License 2.0
353 stars 164 forks source link

Error sp.create_login_request_url with vitejs #277

Open joseronero opened 10 months ago

joseronero commented 10 months ago

sp.create_login_request_url with vitejs

Error: Uncaught TypeError: crypto.randomBytes is not a function

file: saml2.js

line 62: id = '_' + crypto.randomBytes(21).toString('hex');

Why? any solution?

Thanks.

darioackermann commented 3 months ago

You are trying to use crypto in a browser if I understand that correctly. That is not possible as the NodeJS crypto module is a native module. There is no way to bundle it in your ViteJS app and run inside a browser.

You probably do not want to expose your SP keys to a (semi-)public frontend anyway.. you will need a backend…