Ionic 2 Instagram Login


#1

Hello ,
I’m trying to implement insgtram login with photo pulling data , I searched and found this


but i’m struggling to implement it , can any one give me a hint or example how to implement it in the app.

Thanks


#2

Hey!
You’ll need to import Auth and User intoapp.component.ts, after you have set up the Ionic cloud, as per Ionic’s setup.

You’ll then create a login page, for example with a button with a (click)="authInstagram()".
In your login.ts, hook up this clicked to a function, which logs in with Instagram as the documentation suggests—
this.auth.login(‘instagram’).then(()=>{
console.log(“Successfully logged into instagram”);
// You can then maybe re-direct to the home page, or whatever page
this.navCtrl.setRoot(HomePage);
})

Maybe you want a log out button too, (click)=logout()

logout(){
  this.auth.logout();
}

The problem you will face is that the Ionic Cloud integration of the Instagram API does not return image data. All you can get is /users/self.

From this you get username, bio, profilepic, and counts of followers, number of pictures—this is the closest to what you’re looking for, but I believe Ionic Cloud won’t be going much further, due to all of Instagram’s API limits and restrictions. You’ll need to look into these further if you’re planning to build an app that pulls images, since basic only allows for a user to see their own data, and approval for API use beyond this is challenging.

To pull images, you’d need a custom set up for the Instagram login, most likely with OAuth, Firebase, or Mongo/MEAN.

Hope this helps, I’m also learning Insta’s API stuff at the moment :slight_smile:


#3

Thanks a lot for your answer .

any idea how can I set userself , the picture of the user ,name , followers and so on.