solid-contrib / solid-auth-fetcher

A client library for authenticating with Solid
Other
2 stars 7 forks source link

Login from nodejs is broken (and most of a fix?) #25

Closed jeff-zucker closed 3 years ago

jeff-zucker commented 3 years ago

Login from nodejs now produces

(node:816301) UnhandledPromiseRejectionWarning: TypeError: form_urlencoded_1.default is not a function
    at TokenRequester.request (/home/jeff/Dropbox/Web/solid/solid-node-client/node_modules/solid-auth-fetcher/dist/login/oidc/TokenRequester.js:53:44)

This error does not occur when using form-urlencoded@4.1.4 but does occur with the latest version 4.5.1. It has something to do with how the function is exported. This change to solid-auth-fetcher's dist/ makes solid-auth-fetcher work with either version, but I can not figure out how to change it in the src/ typescript.

// Remove ths line (20) in dist/login/oidc/TokenRequester.js
Line 20 const form_urlencoded_1 = __importDefault(require("form-urlencoded"));
// Replace with these : 
let form_urlencoded_1 = __importDefault(require("form-urlencoded"));
if( typeof form_urlencoded_1.default != "function" ) {
  form_urlencoded_1 = form_urlencoded_1.default ;
} 
jeff-zucker commented 3 years ago

Note : on my system, installing from a git\hub fork works but installing from the npm does not - it pulls in the newer form-urlencoded.

jeff-zucker commented 3 years ago

On the up side - people are using this nodejs login via solid-node-client to run express apps on android. :-)