Open onesyah05 opened 1 year ago
I am also getting this error. Notably, however, I am also encountering the same error when logging in with Meta's Threads application. So I am thinking that this is not a problem with this library, but that we are temporarily banned from Threads by Meta.
(I think it can be pointed out that the current threads-api model is to log in to threads for each execution, and this can easily lead to banning. A simple mechanism to serialize login sessions and use them across executions may be required.)
If you don't want to log in for each execution, you should persist your auth token somewhere, in a DB for example, and reuse that in future executions
I am also getting this error. Notably, however, I am also encountering the same error when logging in with Meta's Threads application. So I am thinking that this is not a problem with this library, but that we are temporarily banned from Threads by Meta.
(I think it can be pointed out that the current threads-api model is to log in to threads for each execution, and this can easily lead to banning. A simple mechanism to serialize login sessions and use them across executions may be required.)
As @wack-overflow said to prevent login each time you can run the code using userID and token, you can get them with getToken
and getUserIDfromUsername
plus you can pass device identifier and device id so it doesn't trigger the "Unauthorized login" each time you do something, this just a measure to lower the chances Instagram flags the account as compromised or spam.
@Aerglonus Could you show us the code how you can login with token
and userId
?
@Aerglonus Could you show us the code how you can login with
token
anduserId
?
Just pass the values to client, in my case i passed some extra properties to avoid requesting new values each time and also avoid getting the account flagged as if it was compromised because of the different deviceID, so my deviceID
its the one from my actual phone and on device
I passed also my phone actual specifications that way Instagram thinks its login in from my already authorized phone.
Note: the
device
andfbLSDToken
properties are not necessary I just use them as an extra step to not trigger any flags on Instagram side..const threadsAPI = new ThreadsAPI({ verbose: true, device: { manufacturer: 'your-phone-manufacturer', model: 'your-phone-model', os_version: android-version, os_release: 'phone-os-version', }, fbLSDToken: 'redacted', noUpdateLSD: true, token: 'redacted', // Your token deviceID: 'android-redacted', // Your device ID userID: 'redacted' });
For those who were having problems finding some of these values, I used an app called Device Info on the Google play store to get the device ID. The rest should be easily available in the settings (model, os version, etc.)
@Aerglonus I tried your approach, but didn't work for me. Here is the code.
const threadsAPI = new ThreadsAPI({
verbose: true,
noUpdateLSD: true,
token,
userID
});
const user = await threadsAPI.getUserProfile(userID);
The result:
TypeError: Cannot read properties of undefined (reading 'userData')
at a.<anonymous> (/node_modules/threads-api/build/threads-api.js:1:9626)
at /node_modules/threads-api/build/threads-api.js:1:1769
at Object.next (/node_modules/threads-api/build/threads-api.js:1:1874)
at a (/node_modules/threads-api/build/threads-api.js:1:350)
at i (/node_modules/threads-api/build/threads-api.js:1:547)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
@Aerglonus I tried your approach, but didn't work for me. Here is the code.
const threadsAPI = new ThreadsAPI({ verbose: true, noUpdateLSD: true, token, userID }); const user = await threadsAPI.getUserProfile(userID);
The result:
TypeError: Cannot read properties of undefined (reading 'userData') at a.<anonymous> (/node_modules/threads-api/build/threads-api.js:1:9626) at /node_modules/threads-api/build/threads-api.js:1:1769 at Object.next (/node_modules/threads-api/build/threads-api.js:1:1874) at a (/node_modules/threads-api/build/threads-api.js:1:350) at i (/node_modules/threads-api/build/threads-api.js:1:547) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
This could be related to what i was seeing recently, when using getToken
that returns the userID
as undefined this is a new issue related to the data that comes back from Threads #188
I am having this same issue, no fix yet?
i can't publish
[LOGIN] Failed to login TypeError: Cannot read properties of undefined (reading 'split') at D:\shoppe\node_modules\threads-api\build\threads-api.js:1:5064 at D:\shoppe\node_modules\threads-api\build\threads-api.js:1:1798 at Object.next (D:\shoppe\node_modules\threads-api\build\threads-api.js:1:1903) at a (D:\shoppe\node_modules\threads-api\build\threads-api.js:1:379) at i (D:\shoppe\node_modules\threads-api\build\threads-api.js:1:576) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)