pingo pingo - 6 months ago 36
Javascript Question

How to request, store, and use an access token in Meteor while using the Instagram API

How does one request, store, and use an access token from an API in the Meteor framework? I am currently trying to make requests from the (Instagram API)[], but I first need to request an access token and store it for later use.

What is the general structure for doing this? I have my Client Id and Client Secret stored in the settings.json and have the services configuration package loaded. I think I need to create some sort of Method using http.get, but if someone could give a brief walkthrough that would be greatly appreciated ! Not much on this in the Meteor Docs.


You can use Bozhao Package for this.

Just install it.

meteor add bozhao:accounts-instagram

And this will work exactly like tha core accounts - facebook || google || twitter

and you can do something like this on the accountsOnCreateUser Methods

if ( {
    console.log("-- REGISTED USER WITH INSTAGRAM ");
    instagramProfile = {
      service: "Instagram",
      profileUrl: ""+
user.profile = instagramProfile;

Now knowing this, you can see that we have the user data inside the object, there should be a accessToken and id field that you make POST / GET http request to the

I have never done a HTTP request to the Instagram API but it should be similar to facebook (if not sorry the below code dosnt help you to much).

Simple http call using the params.

Meteor.http.get("", {
      headers: {
        "User-Agent": "Meteor/1.0"
      params: {