ramtinak / InstagramApiSharp

A complete Private Instagram API for .NET (C#, VB.NET).
MIT License
780 stars 239 forks source link

The username you entered doesn't appear to belong to an account. Please check your username and try again. #561

Closed june8071 closed 1 year ago

june8071 commented 1 year ago

I've:

Issue category

Language

Usage

Operating System

Describe your issue

public async Task<bool> MainAsync()
        {
            var userSession = new UserSessionData
            {
                UserName = tb_LoginId.Text,
                Password = tb_LoginPw.Text
            };

            var delay = RequestDelay.FromSeconds(0, 1);
            InstaApi = InstaApiBuilder.CreateBuilder()
                    .SetUser(userSession)
                    .UseLogger(new DebugLogger(LogLevel.All)) // use logger for requests and debug messages
                    .SetRequestDelay(delay)
                    .SetSessionHandler(new FileSessionHandler() { FilePath = stateFile })
                    .Build();

            LoadSession();

            if (!InstaApi.IsUserAuthenticated)
            {
                // login
                await InstaApi.SendRequestsBeforeLoginAsync();
                await Task.Delay(3000);
                var logInResult = await InstaApi.LoginAsync();

                if (!logInResult.Succeeded)
                {
                    string ret = logInResult.Info.Message;

                    return false;
                }
                else
                {
                    await InstaApi.SendRequestsAfterLoginAsync();
                    SaveSession();
                }
            }
            var state = InstaApi.GetStateDataAsStream();

            using (var fileStream = File.Create(stateFile))
            {
                state.Seek(0, SeekOrigin.Begin);
                state.CopyTo(fileStream);
            }
            return false;
        }

FROM [ var logInResult = await InstaApi.LoginAsync(); ] I've got Error [The username you entered doesn't appear to belong to an account. Please check your username and try again.].

It's perfect string what I entered username, password. And I only could get this same error even I tried with another 4 accounts.

I can login Instagram Web( https://www.instagram.com/ ) with same account. Only I got this error when I tried to login using InstagramAPISharp....

would you guys let me know some solution..?

CarlosTorrecillas commented 1 year ago

I may be wrong but in my experience that has happened to me when I try to login unsucessfully, multiple times, in a short period of time and looks like Instagram blocks the IP from making any more requests. So although your user and pass are valid, your client seems to be blocked. Hope it helps

leila-net commented 1 year ago

I have the same error in login, could you find any solution ?

boristomas commented 1 year ago

Same here :/

TheDeveloper10 commented 1 year ago

And same here... Isn't it strange how all of a sudden multiple people face the same issue? I literally didn't have this issue for the past 30 days and since today I started facing it!

june8071 commented 1 year ago

@leila-net @boristomas @TheDeveloper10 First, Sorry, I'm not good at Eng. So maybe my sentence is not perfect.

I solved this problem. In my case, It was problem about IP. It works when I try to login with my moblie hotspot even I don't know the reason.

So I just changed and fixed my MAC Address for changing my IP, because my IP was dynamic. And It perfectly works til now.

I guess blocked IP? I don't have any skill about network system, so I'm not sure about this problem even solution. Just working now for me.

Hope to work for you guys too.

leila-net commented 1 year ago

I tested in two system with different IP , and again get the error . so I think it's not about IP blocking. I could not understand what did you do with Your MAC ? "So I just changed and fixed my MAC Address for changing my IP"

june8071 commented 1 year ago

@leila-net My problem was same with you. I've got this problem with 2 different IP, PC even different location in same time. And make it well with changing IP. Just in my case.. It's my solution even if it's not working for you guys.

reference : https://www.digitalcitizen.life/change-mac-address-windows/

boristomas commented 1 year ago

I don't understand why you closed this issue?? It is still persistent. (i tried changing mac and ip)

ramtinak commented 1 year ago

Hey, A simple solution: Enabling 2 factor authentication for your accounts fixes this problem at some point. This is a Instagram problem, I had this issue with my own account and Instagram app after hard resetting my phone a few weeks ago.

In November 1, they said they fixed it but I don't believe it: https://twitter.com/InstagramComms/status/1587202825762766848?s=20&t=Oqd0Gfxedufb9ni-rO4EWw

A side note (not related to the issue) Instagram sends device ids each time you are trying to sign-in and somehow registers them via logging_client_events APIs. (This is a thought, not a fact) So they can find out which device belongs to which accounts. I think they are implementing a new way to fight with bots and spammers, each account that doesn't have a 2FA enabled and trying to log-in in a different IP/Mac/or whatever crosses this issue.

Screenshot 2022-11-05 180551

Regards.

pepoon commented 1 year ago

Iep, It is happening to me running a mini program on aws ec2. I enabled 2fa using my phone. But the program in ec2 can't manage to login. Then I tried to disable the 2fa and the program still did not work. I setup a new ec2 instance with a different ip, but using the same account. And also did not work... Did you guys fixed it?

RealBrubru commented 1 year ago

Iep, It is happening to me running a mini program on aws ec2. I enabled 2fa using my phone. But the program in ec2 can't manage to login. Then I tried to disable the 2fa and the program still did not work. I setup a new ec2 instance with a different ip, but using the same account. And also did not work... Did you guys fixed it?

Same here, but with Azure.

pepoon commented 1 year ago

SOLUTION: it is because of warehouse IPs. You need to get a residency proxy (or look for instagram proxy).

CarlosTorrecillas commented 1 year ago

Have yo guys found any workaround it? It's very frustrating the fact I get "IP blocked" (by the look of all opinions) and I can't get around it. In my use-case that happens when I try to re-log in after a few days of having the same session active