T
T
teertsneerg2020-06-05 16:11:57
JavaScript
teertsneerg, 2020-06-05 16:11:57

Why is the request not being authenticated?

Hello. I'm trying to make a request using the request module

request({
        url: config.endpoint+'/name',
        auth: {
            username: 'Name',
            password: 'Pass'
        },
        method: 'POST',
        json: true,
        strictSSL: false,
        body: {json: 123}
    }, async (e, resp, data) => {
    });


But I get an authentication error. At the same time, the following curl from the console works fine:

curl -k -u Name:Pass -H 'Content-Type: application/json' -d '{"data":"123"}' https://url/name


What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
teertsneerg, 2020-06-05
@teertsneerg

UPD: I made a request to my server with curl and request, the Authorization header comes the same

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question