vrchatapi / vrchatapi-javascript

🟡 VRChat API Library for JavaScript and TypeScript
https://www.npmjs.com/package/vrchat
MIT License
41 stars 16 forks source link

Requests blocked by WAF due to User-Agent #7

Open theautonomousdev opened 1 month ago

theautonomousdev commented 1 month ago

By default requests are blocked by the WAF due to User-Agent header with the response:

{
    "error": {
        "message": "\"please identify yourself with a properly formatted user-agent containing application name, version and contact information. thank you!\"",
        "status_code": 403,
        "waf_code": 13799
    }
}

Overriding the baseOptions on the configuration to add a custom User-Agent resolves the issue:

const configuration = new vrchat.Configuration({
  username,
  password,
  baseOptions: {
    headers: { "User-Agent": "Test" },
  },
});

Are you able to add a custom User-Agent by default or update the example code to include a custom User-Agent so it's clear that it's required?

Rexios80 commented 1 month ago

We should not add a user agent by default, and even including one in the example is a bit iffy because people will just copy/paste the code and not change it, but maybe we could show it in the example in a non-functional way?

theautonomousdev commented 1 month ago

We should not add a user agent by default, and even including one in the example is a bit iffy because people will just copy/paste the code and not change it, but maybe we could show it in the example in a non-functional way?

I see your point, I think having it noted somewhere under the "Getting Started" section in the README or as a comment in the example code should suffice.

Even though the response error message is clear about what the issue is I had to dig into the code to identify how to override the User-Agent as it wasn't clear how or even if it was possible.

ariesclark commented 1 month ago

TimmyFriendTracker/1.5.1 timmy@example.com is an example we've used before, and it is blocked, so it doesn't work by default unless you change it.