jlobos / instagram-web-api

🤳 Instagram Private Web API client for Node
https://npmjs.com/instagram-web-api
MIT License
1.12k stars 189 forks source link

‘StatusCodeError: 405 - undefined’ on `client.logout()` #287

Closed maxrdz closed 2 years ago

maxrdz commented 2 years ago

Below is a simplified snippet of my project’s code, just including how it handles login and logout.

;(async () => {
    while (true) {
        try {
            await client.login();
        } catch (err) {
            // Print and log error to disk
        }

        // Main program logic

        try {
            await client.logout();
        } catch (err) {
            // Print and log error to disk
        }
        await sleep(INTERVAL);
    }
});

Once it reaches await client.logout();, it returns the error StatusCodeError with an error message of “405 - undefined”.

As far as I know from a quick google search, a 405 status response is for “Method Not Allowed”. I am using persistent cookie storage and the login / API calls on the main program logic works perfectly fine, so I know this is not a token/authentication issue. 2-factor authentication is not being used in the account logged in. Does client.logout() use a deprecated API call? If not, please let me know what could be going wrong? Thanks.