Closed softwareninja closed 4 years ago
This should work. Try to delete the state.json
and run the example. Check if the state.json
constains fbns
. Then you can run it again an it should read the values from fbns.
Removing state.json and running the command again, I got 400 error at login. Do I have to use api token or something similar for authentication instead of username and password?
Are username and password set?
Yes.
IG_USERNAME=...
IG_PASSWORD=...
Is it set at runtime? If so, what's the error you're getting?
(node:63966) UnhandledPromiseRejectionWarning: IgCheckpointError: POST /api/v1/accounts/login/ - 400 Bad Request; challenge_required
at Request.handleResponseError (/Users/dev/Downloads/instagram_mqtt-master/node_modules/instagram-private-api/src/core/request.ts:143:16)
at Request.send (/Users/dev/Downloads/instagram_mqtt-master/node_modules/instagram-private-api/src/core/request.ts:78:24)
(node:63966) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:63966) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Hi @Nerixyz That was helpful. I was able to pass the challenge but now I have:
error IgCookieNotFoundError: Cookie "ds_user_id" not found
at State.extractCookieValue (/Users/dev/Downloads/instagram_mqtt-master/node_modules/instagram-private-api/src/core/state.ts:185:13)
at State.get cookieUserId [as cookieUserId] (/Users/dev/Downloads/instagram_mqtt-master/node_modules/instagram-private-api/src/core/state.ts:166:17)
at FbnsClient.sendPushRegister (/Users/dev/Downloads/instagram_mqtt-master/src/fbns/fbns.client.ts:375:38)
at FbnsClient.handleMessage (/Users/dev/Downloads/instagram_mqtt-master/src/fbns/fbns.client.ts:326:32)
at process._tickCallback (internal/process/next_tick.js:68:7)
Do I need to run this example on browser where cookies are supported?
There's something wrong with your state. Make sure it gets loaded properly (e.g. set a breakpoint before the fbns.connect() call and inspect ig.state.cookieJar
which should contain ds_user_id
).
If this doesn't contain the cookie open the state file and search for the cookie. If it isn't there delete the file and log back in.)
I deleted the state.json and tried to login several times. Every time I got challenge_required error.
I need this example running eventually on my angular app. Is there any way to get this integrated on Angular app? Is that even possible?
You're getting this error brecause you're essentially using a new device to login. However your state (and thus your cookies) do not get saved/loaded. If your angular app is running inside of a browser, this won't work as raw TLS sockets are not allowed there. You'd have to create a bridge over WebSockets for example.
Do you have any idea on how you would bridge the two? @Nerixyz
Do you think this could work?
https://github.com/JetClosing/graphql-lambda-websocket
Do you have any idea on how you would bridge the two?
This could be achieved through web-sockets. You'd then have to create your own "message-format".
I tried to run the push example.
"push": "ts-node examples/push.example"
npm run push
I get following error:
Can anyone help me with this issue please?