मैं Node.js ऐप लिख रहा हूं और प्रमाणीकरण प्राप्त करने के लिए एडीएफएस सर्वर को एकीकृत करने की कोशिश कर रहा हूं। इसके लिए, मैं wstrust-client
का उपयोग कर रहा हूं, और एडीएफएस सर्वर यूआरएल का उपयोग अपने एंडपॉइंट के रूप में कर रहा हूं। मेरे कोड अब तक है:HTTP 400: ADFS HTTPS अनुरोध में खराब अनुरोध त्रुटि
app.get('/login', function(req, res) {
trustClient.requestSecurityToken({
scope: 'https://mycompany.com',
username: "username",
password: "password",
endpoint: 'https://[adfs server]/adfs/services/trust/13/usernamemixed'
}, function (rstr) {
// Access the token
var rawToken = rstr.token;
console.log('raw: ' + rawToken);
}, function(error) {
console.log(error)
});
});
मैं विनती करता हूँ https के माध्यम से wstrust-client
wstrustclient.js
में मेरे कोड अब तक है:
var req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function(data) {
console.log("Entered res")
var rstr = {
token: parseRstr(data),
response: res,
};
callback(rstr);
});
});
req.write(message);
req.end();
req.on('error', function (e) {
console.log("******************************");
console.log(e);
console.log("******************************");
हालांकि, यह इस त्रुटि फेंक है:
******************************
{ [Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE]
stack: 'Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE\n
at SecurePair.<anonymous> (tls.js:1253:32)\n
at SecurePair.EventEmitter.emit (events.js:91:17)\n
at SecurePair.maybeInitFinished (tls.js:865:10)\n
at CleartextStream.read [as _read] (tls.js:416:15)\n
at CleartextStream.Readable.read (_stream_readable.js:231:10)\n
at EncryptedStream.write [as _write] (tls.js:329:25)\n
at EncryptedStream.Writable.write (_stream_writable.js:176:8)\n
at write (_stream_readable.js:496:24)\n
at flow (_stream_readable.js:506:7)\n
at Socket.pipeOnReadable (_stream_readable.js:538:5)' }
******************************
******************************
{ [Error: read ECONNRESET]
stack: 'Error: read ECONNRESET\n
at errnoException (net.js:846:11)\n
at TCP.onread (net.js:508:19)',
code: 'ECONNRESET',
errno: 'ECONNRESET',
syscall: 'read' }
******************************
जब मैं ब्राउज़र में एक ही एंडपॉइंट यूआरएल ब्राउज़ करता हूं, तो यह HTTP 400: Bad Request
मुझे पता है कि यह एक एसएसएल प्रकार त्रुटि है, और यह सर्वर-साइड से है। हालांकि, मुझे नहीं पता कि यह त्रुटि क्यों फेंक रहा है और गलत सर्वर-साइड क्या हो सकता है। मुझे बदलने की क्या ज़रूरत है?