vrchatapi-javascript icon indicating copy to clipboard operation
vrchatapi-javascript copied to clipboard

Requests blocked by WAF due to User-Agent

Open theautonomousdev opened this issue 1 year ago • 3 comments

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?

theautonomousdev avatar Jul 18 '24 13:07 theautonomousdev

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?

Rexios80 avatar Jul 18 '24 14:07 Rexios80

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.

theautonomousdev avatar Jul 18 '24 14:07 theautonomousdev

TimmyFriendTracker/1.5.1 [email protected] is an example we've used before, and it is blocked, so it doesn't work by default unless you change it.

ariesclark avatar Jul 19 '24 01:07 ariesclark