Skip to content

Authentication

Stan van Rooy edited this page Jul 27, 2021 · 4 revisions

Table of contents

1. Simple authentication

If you want to login through Instauto, you need to construct the ApiClient with both a username and password. Example:

from instauto.api.client import ApiClient

client = ApiClient(username='your_username', password='your_password')
client.log_in()

1.1 Challenge

It is possible that Instagram flags the request as suspicious, in those cases, one of the following will happen:

  1. you need to verify the login on another device;
  2. or you need to enter a verification code, this requires input through the terminal.

1.2 2FA

Instauto supports two-factor authentication. To verify your account, you can either:

  1. enter the verification code in the the terminal;
  2. or use a function provided to the constructor named _2fa_function :
def get_2fa_code(username: str) -> str:
    # do something to get the code
    return code

client = ApiClient(username='your_username', password='your_password', _2fa_function=get_2fa_code)

Clone this wiki locally