Davincible / goinsta

Unofficial Instagram API written in Golang (v2022)
MIT License
182 stars 54 forks source link

login with 2fa otp auth #20

Closed vtolstov closed 2 years ago

vtolstov commented 2 years ago

My account have 2fa enabled via google authenticator. How can i login with this lib in this case (i can generate 2fa code via go package based on secret)

Davincible commented 2 years ago

Haven't looked at that yet, will put it on the todo!

Davincible commented 2 years ago

I have updated the wiki with the following example:

...

err := insta.Login()
if err == goinsta.Err2FARequired {
  err2FA := insta.TwoFactorInfo.Login2FA(code)
  if err2FA != nil {
    ...
  }
} else if err != nil {
  ...
}

Can you let me know if this works for you?

Also, which go package do you use to generate the 2FA code?