mhoc / axios-digest-auth

Axios-like HTTP Digest Auth
https://axios-digest-auth.mhoc.co
The Unlicense
12 stars 20 forks source link

AxiosDigestAuth is not a constructor #3

Open mitch85 opened 3 years ago

mitch85 commented 3 years ago

Hi,

i install the package and clone your example Project.

import AxiosDigestAuth from "@mhoc/axios-digest-auth";

const digestAuth = new AxiosDigestAuth({
  password: "pass",
  username: "user",
});

const response = await digestAuth.request({
  headers: { Accept: "application/json" },
  method: "POST",
  data,
  url,
});

i get an error :(

const digestAuth = new AxiosDigestAuth({
                   ^

TypeError: AxiosDigestAuth is not a constructor
grzegorz914 commented 2 years ago

Same for me with 0.7.0

TypeError: AxiosDigestAuth is not a constructor

vincepich commented 2 years ago

Same for me with 0.8.0

ranfysvalle02 commented 2 years ago

I was running into a similar issue and I fixed it by doing:

const AxiosDigestAuth = require('@mhoc/axios-digest-auth').default;

const digestAuth = new AxiosDigestAuth({username: "_______",password: "_______",});

const response = await digestAuth.request();

kalimuthu-zluri commented 1 year ago

how to do that using import statement

robjames commented 1 year ago

import { default as DigestFetch } from "digest-fetch"

git-headswap commented 1 year ago

I used the following instead and it works. https://www.npmjs.com/package/@lukesthl/ts-axios-digest-auth

rohanpatelg commented 1 year ago

how to do that using import statement

import _AxiosDigestAuth from "@mhoc/axios-digest-auth"; const AxiosDigestAuth = _AxiosDigestAuth.default; const digestAuth = new AxiosDigestAuth({username: "",password: "",});

const response = await digestAuth.request();