Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get instagram access_token without user interaction(new api)?

With instagrams new api changes, it appears that there is no way to get an access_token without having some sort of user interaction. All of the documentation that I have found has stated that there is a mandatory pass through of loggin in authorizing an app via a user interaction(https://www.instagram.com/developer/authentication/):

Server-side (Explicit) Flow

Step One: Direct your user to our authorization URL

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code Note: You may provide an optional scope parameter to request additional permissions outside of the “basic” permissions scope. Learn more about scope.

Note: You may provide an optional state parameter to carry through a server-specific state. For example, you can use this to protect against CSRF issues.

At this point, we present the user with a login screen and then a confirmation screen where to grant your app access to her Instagram data.

Client-Side (Implicit) Authentication

Step One: Direct your user to our authorization URL

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token At this point, we present the user with a login screen and then a confirmation screen where they grant your app’s access to their Instagram data. Note that unlike the explicit flow the response type here is “token”.

With an access_token that refreshes periodically, is it possible to to get the access token without user interaction?

I am trying to display my feed on my site but I haven't found a way besides the embed options they offer after the API changes.

EDIT: My question getting marked as a dupe of Instagram OAuth Access Token expiration for app but I am not looking at figuring out the expiration(that is not explicitly defined in the IG documentation). I want a purely programmatic way to get the the access_token.

like image 767
ninjasense Avatar asked Jun 07 '16 19:06

ninjasense


1 Answers

I'm having this issue too. I'm assuming you want to write a script to run things for you.

One (rather lame) solution would be to use selenium, phantom JS, headless chrome, or any other similar tech to visit the login screen to fill in the account credentials (throw security out the window), before grabbing the code from the following redirect URL...

It's a shame that Instagram doesn't allow this type of non-user-required account option.

like image 112
Nick Knuckle Avatar answered Sep 17 '22 13:09

Nick Knuckle