Saturday, March 11, 2017

Instagram php laravel access token

I was able to get the code from instagram api. The next step is to post the client_id, client_secret, grant_type, redirect_uri and code to https://api.instagram.com/oauth/access_token as shown below.

The instagram API says that "you simply have to POST this code, along with some app identification parameters, to our access_token endpoint."

 curl -F 'client_id=CLIENT_ID' \
    -F 'client_secret=CLIENT_SECRET' \
    -F 'grant_type=authorization_code' \
    -F 'redirect_uri=AUTHORIZATION_REDIRECT_URI' \
    -F 'code=CODE' \
    https://api.instagram.com/oauth/access_token

How can I do this in my laravel controller or php script? How do I put all these information as a variable and post it to the uri to get back the json object? Thank you



via Desmond

Advertisement