instagram
instagram copied to clipboard
Attempt to decode JSON with unexpected mimetype
Expected Behavior
A normal login process
Current Behavior
When I try to type login myusername mypassword, I get in return as a answer from the bot:
Unhandled error while handling command:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/mautrix/bridge/commands/handler.py", line 405, in handle
await self._run_handler(handler, evt)
File "/usr/lib/python3.8/site-packages/mautrix/bridge/commands/handler.py", line 290, in __call__
return await self._handler(evt)
File "/usr/lib/python3.8/site-packages/mautrix_instagram/commands/auth.py", line 66, in login
api, state = await get_login_state(evt.sender, username, evt.config["instagram.device_seed"])
File "/usr/lib/python3.8/site-packages/mautrix_instagram/commands/auth.py", line 46, in get_login_state
await api.qe_sync_login_experiments()
File "/opt/mautrix-instagram/mauigpapi/http/qe.py", line 26, in qe_sync_login_experiments
return await self.__sync(self.state.application.LOGIN_EXPERIMENTS)
File "/opt/mautrix-instagram/mauigpapi/http/qe.py", line 41, in __sync
resp = await self.std_http_post("/api/v1/qe/sync/", data=req, response_type=QeSyncResponse)
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 121, in std_http_post
json_data = await self._handle_response(resp)
File "/opt/mautrix-instagram/mauigpapi/http/base.py", line 143, in _handle_response
body = await resp.json()
File "/usr/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1097, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://i.instagram.com/accounts/login/')
Possible Solution
Googling this exact error, I got a few interesting responses:
- Python - Attempt to decode JSON with unexpected mimetype
- JSON.parse() does not work when content-type is set to application/json
Steps to Reproduce
- Create an account with 2-FA enabled
- Fail to properly login
- Deactivate 2-FA
- Try to log-in again
Environment
- Docker installation (for mautrix-instagram)
- Caddy reverse-proxy (for Matrix bridges)
- Traefik reverse-proxy (for the Matrix synapse)
Any ideas what could be causing this?
Even after deactivating, excluding the container, resetting the database and ensuring everything was connected, I still face a similar issue while logging in:
File "/usr/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1097, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://i.instagram.com/accounts/login/')
Which makes me suspect it may have something to do with my account being linked to my facebook account to OAuth, although I have both username and password through Instagram's interface. I'm not sure what to try next.