jlobos / instagram-web-api

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

getProfile returned undefined #152

Open HulioEglesias opened 4 years ago

HulioEglesias commented 4 years ago

I used an example code and got undefined. code:

const Instagram = require('instagram-web-api')

const client = new Instagram({ username:'user', password:'pass'})

;(async () => {
  await client.login()
  const profile = await client.getProfile()

  console.log(profile)
})()
lucasabreuo commented 4 years ago

Use console.log(client) and make sure the username and password are filled in the Instagram object in parameter 'credentials'.

MonsieurBibo commented 3 years ago

Are you still dealing with this issue ?

Freccia commented 2 years ago

I have the same issue, here's my code:

require('dotenv').config()

const Instagram = require('instagram-web-api')
const { username, password } = process.env

const client = new Instagram({ username, password })

console.log(client)

client
  .login()
  .then(() => {
    client
      .getProfile()
      .then(console.log)
  })

and the output :

➜  folder $ npm start

> instagram-bot@1.0.0 start
> node index.js

Instagram {
  credentials: { username: 'myusername', password: 'mypassword' },
  request: [Function (anonymous)] {
    get: [Function (anonymous)],
    head: [Function (anonymous)],
    post: [Function (anonymous)],
    put: [Function (anonymous)],
    patch: [Function (anonymous)],
    del: [Function (anonymous)],
    delete: [Function (anonymous)],
    cookie: [Function (anonymous)],
    jar: [Function (anonymous)],
    defaults: [Function (anonymous)]
  }
}
undefined

any ideas why ?