tngan / samlify

Node.js library for SAML SSO
https://samlify.js.org
MIT License
610 stars 216 forks source link

"url" argument must be of type string. Received an instance of Object #405

Open subu1979 opened 3 years ago

subu1979 commented 3 years ago

I have referred the URL https://samlify.js.org/#/onelogin Based on the above I have created the sample application, when I called the URL

http://localhost:3000/sso/spinitsso-redirect

Error Details:-

The "url" argument must be of type string. Received an instance of Object TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received an instance of Object at validateString (internal/validators.js:117:11) at Url.parse (url.js:159:3) at Object.urlParse [as parse] (url.js:154:13) at buildRedirectURL (D:\keycloak\client\SAML_Keycloak\node_modules\samlify\build\src\binding-redirect.js:37:25) at Object.loginRequestRedirectURL (D:\keycloak\client\SAML_Keycloak\node_modules\samlify\build\src\binding-redirect.js:86:22) at ServiceProvider.createLoginRequest (D:\keycloak\client\SAML_Keycloak\node_modules\samlify\build\src\entity-sp.js:79:47) at D:\keycloak\client\SAML_Keycloak\routes\sso.js:23:24 at Layer.handle [as handle_request] (D:\keycloak\client\SAML_Keycloak\node_modules\express\lib\router\layer.js:95:5) at next (D:\keycloak\client\SAML_Keycloak\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (D:\keycloak\client\SAML_Keycloak\node_modules\express\lib\router\route.js:112:3)

sibelius commented 2 years ago

did you find a workaround?

sibelius commented 2 years ago

I have a similar issue

Error while answering request { error: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received an instance of Array at new NodeError (node:internal/errors:371:5) at validateString (node:internal/validators:120:11) at Url.parse (node:url:169:3) at Object.urlParse (node:url:156:13) at buildRedirectURL (/app/node_modules/samlify/build/src/binding-redirect.js:74:25)

jlaustill commented 2 years ago

I'm running into this same error today, has anyone had any luck figuring it out?

jlaustill commented 2 years ago

Ok, I figured out that this happens when your metadata doesn't contain the binding data needed for what you are trying to do. I was trying to create a redirect binding response, but my metadata only has post data in it. After switching to post, it is working for me. It would be nice if there was a better error reporting on that, maybe.