Replies: 1 comment
-
As an update, I disabled the user-agent generation and only am auto generating the content-length and it still works for MFA. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
TLDR: Check your headers. Autogenerating headers fixed my issue.
I ran into an interesting problem that was infuriating to resolve so I thought I'd share it here. I am building a python auth capture proxy library based on aiohttp that basically is intended to allow credential interception of any oauth page. It is intended to help fix the tesla integration at Home Assistant because frankly I hate fixing screen scraping implementations particularly if they require Javascript processing on the client side.
The error message arises when you do the post to
https://auth.tesla.com/oauth2/v3/authorize/mfa/verify
with the MFA code which replicates this call from Tesla's MFA page.Any submission of the code whether malformed or not would result in:
The fix was letting aiohttp just autogenerate new headers with the post request. In the example code below when I commented out the
headers
parameter, I was able to submit the MFA code and succeed with the login. When I had the headers, I would get:I don't understand why this works, as the same headers worked for every other interaction except for the post json. But since it works repeatedly. I'll go with it. Here's the headers if anyone wants to experiment to figure out the minimum.
Good (autogenerated by aiohttp):
Bad (generated by browser with replacements):
Beta Was this translation helpful? Give feedback.
All reactions