Need help on using DirectAdmin API (Unauthorized Error)

Hello!

I am having a weird issue when using DA's API with basic auth (MXroute).

I'm 100% certain the credentials are correct, however I'm getting "Unauthorized" error on every even requests, while the API works fine on every odd requests.

I'll put a screenshot of my current code, as well as the error I'm getting when the "Unauthorized" error happens. If anyone experienced this issue, or knows a fix for it, any input will be highly appreciated.

Thanks!



Comments

  • OK, so I found the issue.

    It seems like when you send both the session cookie and the authentication credentials, DA will clear the session and log you out.

    I was able to fix it by disabling cookie on requests.session.

  • ialexpwialexpw OGServices Provider

    @sanvit said:
    OK, so I found the issue.

    It seems like when you send both the session cookie and the authentication credentials, DA will clear the session and log you out.

    I was able to fix it by disabling cookie on requests.session.

    Also in case you missed it, there's a typo in applicatoin/json (application) :smile:

    Thanked by (1)sanvit
  • Applicatoin is a good name for a new coin.

    Thanked by (1)sanvit

    ♻ Amitz day is October 21.
    ♻ Join Nigh sect by adopting my avatar. Let us spread the joys of the end.

  • @ialexpw said:

    @sanvit said:
    OK, so I found the issue.

    It seems like when you send both the session cookie and the authentication credentials, DA will clear the session and log you out.

    I was able to fix it by disabling cookie on requests.session.

    Also in case you missed it, there's a typo in applicatoin/json (application) :smile:

    Lol that part was actually written by GitHub Copilot. Seems like there’s yet another reason to not use it?

    Thanked by (1)ialexpw
Sign In or Register to comment.