Instagram-private-api: How to get the user currently logged in based on stored cookies?

Created on 8 Dec 2019  路  4Comments  路  Source: dilame/instagram-private-api

General Question

Read the Notes and fill out the form.
Switch to Preview for reading.

Notes

Your issue will be closed if you violate any rule below.

  • You need to include a meaningful descriptions and e.g. a screenshot.
  • You do not include screenshots of your code.
  • Read the Docs.
  • Capturing endpoints and similar can be found here
    (read it if you are going to ask about it).
  • You can delete this section after reading it.

Form

Put an [x] if you meet the condition, else leave [ ].

Question

How to get the user information currently logged in based on stored cookies? Do I need to login again or can I get that saved status information?

I am looking for this response data:

{
    pk: number;
    username: string;
    full_name: string;
    is_private: boolean;
    profile_pic_url: string;
    profile_pic_id: string;
    is_verified: boolean;
    has_anonymous_profile_picture: boolean;
    can_boost_post: boolean;
    is_business: boolean;
    account_type: number;
    is_call_to_action_enabled: null;
    can_see_organic_insights: boolean;
    show_insights_terms: boolean;
    reel_auto_archive: string;
    has_placed_orders: boolean;
    allowed_commenter_type: string;
    nametag: AccountRepositoryLoginResponseNametag;
    allow_contacts_sync: boolean;
    phone_number: string;
    country_code: number;
    national_number: number;
}
question

Most helpful comment

ig.state.cookieUserId contains the current user id.
So to get the user info you can do this: ig.user.info(ig.state.cookieUserId).

All 4 comments

ig.state.cookieUserId contains the current user id.
So to get the user info you can do this: ig.user.info(ig.state.cookieUserId).

Thanks, that was what I was looking for.

Thanks @acollazo25

How can I create a cookie, save the user's information, then log in with that information? Can you share your own code?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DKertson16 picture DKertson16  路  10Comments

LouenLeoncoeur picture LouenLeoncoeur  路  12Comments

zalkanorr picture zalkanorr  路  12Comments

ozican picture ozican  路  143Comments

MMrR0b0TT picture MMrR0b0TT  路  18Comments