Sorunome / mx-puppet-instagram

An instagram matrix puppeting bridge
Apache License 2.0
30 stars 13 forks source link

Unable to link account (IgResponseError: POST /api/v1/accounts/read_msisdn_header/ - 302 Found) #30

Open jakecoppinger opened 3 years ago

jakecoppinger commented 3 years ago

I get this error when linking - is this a bug? I'm unable to link and the link ... ... message isn't marked as seen.

Installed via matrix-docker-ansible-deploy. list and help in the room with the bot works fine.

Nov 07 07:49:39 jakes-staging-matrix-server matrix-mx-puppet-instagram[2383]: Nov-7 07:49:39.057 [bot-sdk-Appservice] info: Processing transaction 157
Nov 07 07:49:39 jakes-staging-matrix-server matrix-mx-puppet-instagram[2383]: Nov-7 07:49:39.058 [bot-sdk-Appservice] info: Processing event of type m.room.message
Nov 07 07:49:39 jakes-staging-matrix-server matrix-mx-puppet-instagram[2383]: 172.18.0.9 - - [07/Nov/2021:07:49:39 +0000] "PUT /transactions/157?access_token=... HTTP/1.1" 200 2 "-" "Synapse/1.46.0"
Nov 07 07:49:39 jakes-staging-matrix-server matrix-mx-puppet-instagram[2383]: Nov-7 07:49:39.066 [BotProvisioner] info: Got message to process with arg=link
Nov 07 07:49:40 jakes-staging-matrix-server matrix-mx-puppet-instagram[2383]: Nov-7 07:49:40.076 [MatrixEventHandler] error: Error handling appservice room.event IgResponseError: POST /api/v1/accounts/read_msisdn_header/ - 302 Found;
Nov 07 07:49:40 jakes-staging-matrix-server matrix-mx-puppet-instagram[2383]:     at Request.handleResponseError (/opt/mx-puppet-instagram/node_modules/instagram-private-api/dist/core/request.js:125:16)
Nov 07 07:49:40 jakes-staging-matrix-server matrix-mx-puppet-instagram[2383]:     at Request.send (/opt/mx-puppet-instagram/node_modules/instagram-private-api/dist/core/request.js:53:28)
Nov 07 07:49:40 jakes-staging-matrix-server matrix-mx-puppet-instagram[2383]:     at async AccountRepository.readMsisdnHeader (/opt/mx-puppet-instagram/node_modules/instagram-private-api/dist/repositories/account.repository.js:237:26)
kumitterer commented 2 years ago

There is an issue about this at https://github.com/dilame/instagram-private-api/issues/1417 - as proposed there, simply commenting all occurrences of preLoginFlow() fixed this for me and the bridge now seems to be working just fine.

Specifically, I commented these lines:

https://github.com/Sorunome/mx-puppet-instagram/blob/aa5d16793d6068751da766b8c0cf7362a35e70af/src/index.ts#L112 https://github.com/Sorunome/mx-puppet-instagram/blob/aa5d16793d6068751da766b8c0cf7362a35e70af/src/client.ts#L71 https://github.com/Sorunome/mx-puppet-instagram/blob/aa5d16793d6068751da766b8c0cf7362a35e70af/src/api.ts#L55

A better solution might be a try-catch around these function calls, although using preLoginFlow() doesn't seem to be necessary at all.