Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More of a question about InstagramAPI._credentials #4

Closed
chiefy opened this issue Dec 20, 2011 · 5 comments
Closed

More of a question about InstagramAPI._credentials #4

chiefy opened this issue Dec 20, 2011 · 5 comments

Comments

@chiefy
Copy link

chiefy commented Dec 20, 2011

First off: thanks for your work on this, I am messing around w/ Instagram for fun right now, but have a few ideas for an app I want to develop.

I was kind of confused by the documentation. So I have my script (using express) logging in and getting a valid access_token. In my Instagram.oauth.ask_for_access_token callback I am setting the access_token as:

Instagram.set("access_token", params["access_token"]);

Then when I try to call Instagram.users.self() without any parameters, I get an error. I looked through the code and it looks like it should be defaulting to Instagram_config["access_token"] but it doesn't get that far - it gets to:

  if ((require != null) && (params[require] != null) || (params['access_token'] != null) || (params['client_id'] != null)) {
        return params;
      }

(sorry, compiled - I'm not so much into CS yet)

And it dies on that line - here's the trace:

TypeError: Cannot read property 'access_token' of undefined
    at InstagramAPI._credentials (/Users/chief/node_modules/instagram-node-lib/lib/class.instagram.js:133:39)
    at InstagramUsers.self (/Users/chief/node_modules/instagram-node-lib/lib/class.instagram.users.js:25:28)
    at /Users/chief/Scripts/getlikes.js:28:26
    at callbacks (/Users/chief/node_modules/express/lib/router/index.js:272:11)
    at param (/Users/chief/node_modules/express/lib/router/index.js:246:11)
    at pass (/Users/chief/node_modules/express/lib/router/index.js:253:5)
    at Router._dispatch (/Users/chief/node_modules/express/lib/router/index.js:280:4)
    at Object.handle (/Users/chief/node_modules/express/lib/router/index.js:45:10)
    at next (/Users/chief/node_modules/express/node_modules/connect/lib/http.js:203:15)
    at Object.handle (/Users/chief/node_modules/express/lib/http.js:84:5)

I am not sure if this is by design, but later you're checking for this._config['access_token'] so maybe a check if params === undefined is needed?

Anyhow, thanks again for your work.

@mckelvey
Copy link
Owner

I’m thinking you’re right about the params check @chiefy. I'll get that added — thanks for the heads up.

D

@joemccann
Copy link

did this get added? I'm getting the same issue now...

@mckelvey
Copy link
Owner

I believe I did @joemccann, but this might be related to #6, which is in the works. I’ll check while there.

@joemccann
Copy link

I fixed it...i'll submit a pull request

joemccann added a commit to joemccann/instagram-node-lib that referenced this issue Aug 20, 2012
@mckelvey
Copy link
Owner

Wonderful, please do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants