In this post we learn how to obtain and access token from the Instagram Basic Display API with a code passed to us from Instagram once the user has authorized our application. The access token we get is short lived meaning it will only be valid for an hour or so. In the next blog post we will learn how to exchange this short lived access token, for a long lived access token which can be used for up to 60 days.
Required to continue: Facebook app with Instagram product added
Step 1: Generate the Authorization URL
This URL will take the user to Instagram and present them with a pop up. The pop up will ask the user to Authorize our app so our app can read the users Instagram information.
Authorization URL Structure
https://api.instagram.com/oauth/authorize?app_id={app-id}&redirect_uri={redirect-uri}&scope=user_profile,user_media&response_type=code
- {app-id}: Instagram App ID. In the developer app dashboard got to “Instagram > Basic Display”
- {redirect-uri}: This must match a URI that has been entered into the apps “Valid OAuth Redirect URIs” in the apps dashboard.
Once you have the Authorization URL, place it inside of an <a> tag for the user to click on.
<!-- Link to take user to Instagram for authorization with our app --> <a href="https://api.instagram.com/oauth/authorize?app_id={app-id}&redirect_uri={redirect-uri}&scope=user_profile,user_media&response_type=code"> Authorize W/Instagram </a>
Step 2: Obtaining the Access Token
When the user Authorizes our app, Instagram sends them to the {redirect-uri} we passed along in the authorization URL and appends on a code. On our website, we will check for this code in the URL. If code exists in the URL, use it to get an access token. If no code variable exists in the URL, display the “Authorize W/Instagram” link from step 1 above. The URL will look like this.
Instagram Redirect URI with code: {redirect-uri}?code={ig-code}
Access Token API Endpoint
Endpoint
https://api.instagram.com/oauth/access_token
Type
POST
Params
- app_id: Instagram App ID. In the developer app dashboard go to “Instagram > Basic Display” and copy the “Instagram App ID”.
- app_secret: Instagram App Secret. In the developer app dashboard go to “Instagram > Basic Display” and copy the “Instagram App Secret”.
- redirect_uri: This must match one of the URIs that has been entered into the apps “Valid OAuth Redirect URIs” in the apps dashboard.
- grant_type: authorization_code
- code: {ig-code}
PHP CURL call to the Access Token API Endpoint
// base endpoint $endpoint = 'https://api.instagram.com/oauth/access_token'; // params the endpoint requires $params = array( 'app_id' => 'INSTAGRAM_APP_ID', // our instagram app id 'app_secret' => 'INSTAGRAM_APP_SECRET', // our instagram app secret 'grant_type' => 'authorization_code', 'redirect_uri' => 'INSTAGRAM_APP_REDIRECT_URI', // our redirect uri 'code' => $_GET['code'] // code instagram sent us in the URL ); // open curl call $ch = curl_init(); // set type to post and pass the fields along curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $params ) ); curl_setopt( $ch, CURLOPT_POST, 1 ); // set curl url curl_setopt( $ch, CURLOPT_URL, $endpoint ); // set other curl options curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); // get response, close curl, make php array $response = curl_exec( $ch ); // close cur curl_close( $ch ); // make nice php array :D $responseArray = json_decode( $response, true ); // print out the response array that contains the access token echo '<pre>'; print_r( $responseArray );
This CURL call hits our Instagram endpoint with the required parameters and receives a response from Instagram with an access token. If any of the parameters are incorrect, an error message will be returned. The access token here is a short lived access token meaning it is not valid for very long. In the next post, this short lived access token will be exchanged for a long lived access token.
That is going to do it for this post! Leave any comments/questions/concerns below and thanks for stopping by the blog!
I enjoyed reading your piece and it provided me with a lot of value.
벼룩시장 신문그대로보기 (구인구직, 부동산) 벼룩시장 신문그대로보기 바로가기 그리고 지역별 벼룩시장 종이신문그대로보기 방법 (구인구직, 부동산) 알아볼게요. 교차로신문 같이 벼룩시장은 지역별 일자리, 구인구직, 부동산 등 다양한 정보를 제공해요. 교차로신문그대로보기 바로가기는 아래에서 확인하고, 오늘은 벼룩시장 신문그대로보기 바로가기 그리고 사용법 섹스카지노사이트
Hello! This is my 1st commnent here so I juwt wanted to give a quick
shout out annd tell yoou I ttuly enjoy redading throujgh your blog posts.
Can you suggest anyy othedr blogs/websites/forums thaqt deal
wit the same subjects? Applreciate it!
You need to participate in a contest for one of the best blogs on the web. I’ll recommend this website!
I am sure this puece of writing haas tiuched alll the internet users, its reallly really
nice post onn building upp new web site.
Its like you read my mind! You appear to understand a lot approximately this, such as you wrote the e book in it or something. I feel that you could do with a few to power the message house a little bit, however other than that, that is great blog. A great read. I will certainly be back.
A person essentially assist to make seriously posts I might state. That is the very first time I frequented your web page and to this point? I surprised with the research you made to make this particular post extraordinary. Great task!
Your house is valueble for me. Thanks!…
Thank you a bunch for sharing this with all people you actually understand what you’re talking approximately! Bookmarked. Please additionally visit my website =). We can have a hyperlink exchange contract between us!
Its such as you learn my mind! You seem to know so much approximately this, like you wrote the e-book in it or something. I feel that you could do with a few p.c. to pressure the message home a little bit, however instead of that, that is great blog. An excellent read. I’ll certainly be back.
Do you have a spzm issue onn this site; I also am a blogger, annd
I was wondering yohr situation; wwe have ceated soe
nice proceduures and wwe are looking tto wap techniques ith other folks,
please shoot mee an e-mail iif interested.
Thanks for another magnificent post. Where else could anyone get that kind of information in such an ideal way of writing? I’ve a presentation next week, and I am on the look for such information.
Excellent post. I was checkiing continuously tis blpog aand I’m impressed!
Extremely heppful information specifically tthe las part :
) I care for suchh infoo much. I wass loooking for thiss certain informatioon forr a
verfy long time. Thank yoou andd best of luck.
거제출장안마
청도페이스라인출장
A few things i have observed in terms of personal computer memory is that often there are specs such as SDRAM, DDR or anything else, that must fit the requirements of the motherboard. If the pc’s motherboard is pretty current and there are no computer OS issues, updating the memory literally will take under one hour. It’s one of the easiest laptop upgrade methods one can visualize. Thanks for spreading your ideas.
WONDERFUL Post.thanks for share..more wait .. …
Almost all of the things you say happens to be supprisingly precise and it makes me ponder why I had not looked at this with this light previously. This article really did switch the light on for me personally as far as this subject matter goes. However there is one particular issue I am not really too comfortable with and while I attempt to reconcile that with the actual main theme of your point, let me see just what all the rest of the visitors have to say.Very well done.
I have been absent for a while, but now I remember why I used to love this site. Thanks , I’ll try and check back more often. How frequently you update your website?
I want to show thanks to the writer just for rescuing me from this particular challenge. Because of looking throughout the online world and finding tricks which were not helpful, I figured my life was well over. Living minus the solutions to the issues you’ve resolved by means of the article content is a crucial case, as well as the kind that would have negatively damaged my career if I hadn’t encountered your blog post. Your primary talents and kindness in dealing with all the details was excellent. I’m not sure what I would have done if I had not come across such a step like this. I’m able to at this moment look ahead to my future. Thanks for your time so much for this impressive and result oriented guide. I won’t be reluctant to refer your web site to anyone who would like assistance about this topic.
You need to take part in a contest for among the finest blogs on the web. I’ll recommend this web site!
I truly appreciate this post. I’ve been looking everywhere for this! Thank goodness I found it on Bing. You’ve made my day! Thx again
Wow, awesome blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your website is magnificent, as well as the content!
https://itgunza.com/700
https://itgunza.com
https//pornmaster.fun/hd/吉安哪裏有小姐全套包夜服務薇信▷182-888-04吉安哪裏有小姐全套包夜服務吉安哪裏有小姐大保健按摩特殊服務▷吉安哪裏有小姐學生妹過夜上門按摩服務-nip
Thanks for the ideas you are revealing on this site. Another thing I’d really like to say is the fact getting hold of copies of your credit score in order to inspect accuracy of any detail would be the first action you have to conduct in credit repair. You are looking to clean up your credit profile from dangerous details mistakes that mess up your credit score.
https://honeytiplabs.com/아이폰-일련번호/
I’m still learning from you, as I’m improving myself. I certainly love reading all that is posted on your website.Keep the stories coming. I enjoyed it!
I agree with your points, excellent post.
I wanted to post you this very small remark to be able to thank you so much as before relating to the great pointers you’ve shared here. It was simply remarkably generous with you to provide freely what most of us could possibly have made available for an e-book to get some cash on their own, primarily considering that you could have tried it in case you desired. These guidelines also served like a fantastic way to understand that other people online have a similar keenness the same as mine to figure out way more with respect to this condition. I am sure there are millions of more pleasant instances up front for people who discover your site.
I view something truly special in this website .
as I website possessor I think the content material here is rattling excellent, thanks for your efforts.
I like this website very much so much great info .
some really interesting points you have written.
Ищите в гугле
Perfect piece of work you have done, this internet site is really cool with fantastic information.
Great post, I believe blog owners should learn a lot from this site its real user friendly.
I regard something truly interesting about your website so I bookmarked.
yeah bookmaking this wasn’t a risky decision outstanding post! .
The following time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my option to read, but I actually thought youd have one thing interesting to say. All I hear is a bunch of whining about one thing that you can fix for those who werent too busy looking for attention.
I like this web blog very much, Its a really nice position to read and get information.
I love the efforts you have put in this, thankyou for all the great articles.
wohh exactly what I was looking for, thankyou for posting.
wohh exactly what I was looking for, appreciate it for putting up.
I respect your work, thanks for all the useful blog posts.
I saw a lot of website but I believe this one holds something extra in it in it
I take pleasure in, lead to I discovered just what I was looking for. You’ve ended my 4 day lengthy hunt! God Bless you man. Have a great day. Bye
as soon as I detected this site I went on reddit to share some of the love with them.
I was looking at some of your posts on this site and I conceive this site is rattling informative ! Retain putting up.
Aw, this was a really nice post. In idea I would like to put in writing like this moreover – taking time and precise effort to make a very good article… but what can I say… I procrastinate alot and certainly not seem to get one thing done.
I found your blog site on google and test a couple of of your early posts. Continue to maintain up the excellent operate. I just further up your RSS feed to my MSN Information Reader. Looking for ahead to reading more from you later on!…
After study a number of of the weblog posts in your web site now, and I actually like your manner of blogging. I bookmarked it to my bookmark website listing and can be checking again soon. Pls try my website online as properly and let me know what you think.
My husband and i felt so delighted when Michael managed to carry out his analysis while using the ideas he came across when using the web site. It’s not at all simplistic to just continually be giving freely concepts which some people could have been trying to sell. Therefore we keep in mind we have you to give thanks to for this. The type of explanations you’ve made, the easy web site menu, the friendships you can help instill – it’s got most exceptional, and it is letting our son in addition to the family believe that the concept is interesting, which is tremendously vital. Thanks for all the pieces!
I抎 must test with you here. Which is not something I normally do! I take pleasure in reading a put up that will make people think. Additionally, thanks for allowing me to comment!
One thing I would like to say is the fact that before purchasing more computer memory, look into the machine in to which it is installed. Should the machine will be running Windows XP, for instance, the actual memory threshold is 3.25GB. Using in excess of this would easily constitute any waste. Make sure that one’s mother board can handle an upgrade volume, as well. Good blog post.
I enjoy the efforts you have put in this, thankyou for all the great articles.
I got what you intend,saved to fav, very nice website .
vardenafil purchase – vardenafil online sales vardenafil pill
Really informative blog post.Really looking forward to read more. Will read on…
With havin so much content and articles do you ever run into any issues of plagorism or copyright infringement? My site has a lot of completely unique content I’ve either written myself or outsourced but it seems a lot of it is popping it up all over the web without my authorization. Do you know any ways to help prevent content from being ripped off? I’d genuinely appreciate it.
ivermectin us – stromectol generic stromectol coronavirus
Music began playing as soon as I opened up this web site, so frustrating!
Hmm is anyone else encountering problems with the pictures on this blog loading?I’m trying to determine if its a problem on my end or ifit’s the blog. Any responses would be greatly appreciated.
I do not even understand how I stopped up right here, however I assumed this submit was once great. I do not recognise who you might be however definitely you are going to a well-known blogger if you are not already. Cheers!
Hey, thanks for the article post. Really Great.
Muchos Gracias for your blog article.Really thank you! Awesome.
Im thankful for the article. Really Great.
Really informative post.Really looking forward to read more. Fantastic.
A big thank you for your blog post.Really thank you! Want more.
I really enjoy the post. Really Great.
I value the blog.Really thank you! Great.
Thanks a lot for the blog.Thanks Again. Cool.
online pharmacy no presc uk pharmacy near me – safe canadian pharmacies
ivermectin tablets ivermectin – ivermectin 4
When someone writes an post he/she retains the plan of a user in his/herbrain that how a user can know it. Thus that’s why thispost is outstdanding. Thanks!
Thanks again for the post.Thanks Again. Want more.
Wow! This can be one particular of the most useful blogs We have ever arrive across on this subject. Basically Magnificent. I’m also an expert in this topic so I can understand your effort.
Great article. I’m dealing with many of theseissues as well..
I loved as much as you’ll receive carried out right here. The sketch is tasteful, your authored subject matter stylish. nonetheless, you command get bought an impatience over that you wish be delivering the following. unwell unquestionably come more formerly again since exactly the same nearly very often inside case you shield this increase.
I needed to thank you for this very good read!! I absolutely loved every little bit of it. I have got you bookmarked to check out new things you post…
what is hydroxychloroquine chloroquine hydroxychloroquine
Hi would you mind sharing which blog platform you’re working with? I’m planning to start my own blog in the near future but I’m having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I’m looking for something completely unique. P.S Sorry for being off-topic but I had to ask!
I’m really enjoying the design and layout of your blog.It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hireout a designer to create your theme? Exceptional work!
I think that is among the so much significant information for me. And i’m satisfied reading your article. However wanna observation on few basic issues, The website style is perfect, the articles is really nice : D. Good task, cheers
I don抰 even know how I ended up right here, however I believed this publish used to be great. I don’t know who you might be but certainly you are going to a famous blogger should you are not already 😉 Cheers!
cymbalta side effects how long do they last cymbalta coupon
What’s up, this weekend is good for me, for the reason that this point in timei am reading this impressive educational article here at my house.
I really like and appreciate your blog post.Really looking forward to read more.
Asking questions are truly pleasant thing if you are notunderstanding something totally, but this piece of writingprovides fastidious understanding yet.
domperidone for lactation induction usage of motilium motilium spc
I got what you mean , regards for putting up.
whoah this blog is fantastic i love reading your articles.
Thanks so much for the article.Thanks Again. Fantastic.
No matter if some one searches for his necessary thing, thus he/shewishes to be available that in detail, thus that thing is maintained over here.
The unique viewpoints you bring to The writing are as captivating as The online presence. Always a pleasure.
One more thing. It’s my opinion that there are many travel insurance web pages of respected companies that let you enter your journey details to get you the estimates. You can also purchase your international holiday insurance policy on-line by using your credit card. All that you should do is usually to enter your own travel particulars and you can begin to see the plans side-by-side. Merely find the package that suits your financial allowance and needs after which use your credit card to buy the item. Travel insurance online is a good way to do investigation for a respected company regarding international travel insurance. Thanks for giving your ideas.
Nice i really enjoyed reading your blogs. Keep on posting. Thanks
Thank you so much for sharing this wonderful post with us.
Precisely what I was looking for, appreciate it for putting up.Here is my blog Sound Joy Earbuds Review
She and her group normally anticipate a response inside 3 business days.
Best private proxies and most useful proxy prices – buy cheap proxy on https://DreamProxies.com
It’s difficult to find well-informed people about this topic, but you sound like you know what you’re talking about! Thanks
Pair this flirty garter belt with your other favorite styles of black lace lingerie.sexy velmaIt features a two-gate hook-and-eye back closure with four adjustable garter straps attached.
Those are yours alright! . We at least need to get these people stealing images to start blogging! They probably just did a image search and grabbed them. They look good though!
https://iziswaps.site/
Excellent post. I was checking continuously this blog and I’m impressed!Very helpful info specially the last part 🙂 I care for such information much.I was looking for this particular info for a long time.Thank you and best of luck.
medication from mexico pharmacy [url=https://mexicanpharmeasy.com/#]mexicanpharmeasy.com[/url] best online pharmacies in mexico
https://iziswaps.site/
Research thesis thesisbyd.com proposal for thesis
seperti kisah mp3
F*ckin’ amazing issues here. I am very satisfied to peer your article. Thank you so much and i’m having a look ahead to contact you. Will you kindly drop me a mail?
The 10 Most Terrifying Things About Affordable Folding Treadmill affordablefolding treadmill; Bradford,
I love your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for you? Plz respond as I’m looking to create my own blog and would like to know where u got this from. thanks
With everything that appears to be developing throughout this specific area, your points of view happen to be quite stimulating. However, I am sorry, because I can not subscribe to your whole idea, all be it exhilarating none the less. It seems to me that your remarks are actually not entirely rationalized and in simple fact you are generally your self not really entirely confident of the assertion. In any event I did enjoy reading through it.
Thank you for sharing indeed great looking !
http://www.fiverr.com/s/Eg2Y0G9
This blog post effectively addresses common misconceptions, debunking myths with solid evidence.
http://www.fiverr.com/s/Eg2Y0G9
http://www.fiverr.com/s/Eg2Y0G9
college essay nursing research essay writing reflection on essay writing
Whats Taking place i am new to this, I stumbled upon this I’ve discovered It absolutely helpful and it has aided me out loads. I am hoping to give a contribution & assist different users like its aided me. Great job.
Wow! This can be one particular of the most helpful blogs We have ever arrive across on this subject. Actually Magnificent. I am also an expert in this topic therefore I can understand your hard work.
I was recommended this website by my cousin. I’m not certain whether this submit is written via him as no one else recognise such precise about my trouble. You’re wonderful! Thank you!
You completed some fine points there. I did a search on the matter and found nearly all folks will go along with with your blog.
This site can be a stroll-through for all of the information you wished about this and didn’t know who to ask. Glimpse right here, and also you’ll definitely uncover it.
Oh my goodness! a tremendous article dude. Thank you Nevertheless I’m experiencing challenge with ur rss . Don’t know why Unable to subscribe to it. Is there anyone getting equivalent rss downside? Anybody who knows kindly respond. Thnkx
Hi there! I’m at work browsing your blog from my new iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the great work!
Hiya, I’m really glad I’ve found this information. Nowadays bloggers publish just about gossips and internet and this is really frustrating. A good site with interesting content, that’s what I need. Thank you for keeping this web site, I will be visiting it. Do you do newsletters? Can not find it.
This actually answered my problem, thank you!
https://www.newsbreak.com/crypto-space-hub-313321940/3799652652916-top-crypto-investments-in-2025-bitcoin-ai-projects-tokenized-assets
visit my article https://medium.com/@RyanNakamoto1/minswap-the-best-platform-for-swapping-crypto-in-2025-a3500dc2d5c7
Of course, what a fantastic website and revealing posts, I will bookmark your site.Have an awsome day!
Hello.This post was really fascinating, especially because I was investigating for thoughts on this subject last Wednesday.
Hello there, I discovered your site by means of Google while searching for a related matter, your site got here up, it seems to be great. I have bookmarked it in my google bookmarks.
My partner and I absolutely love your blog and find nearly all of your post’s to be exactly what I’m looking for. can you offer guest writers to write content for you personally? I wouldn’t mind creating a post or elaborating on many of the subjects you write about here. Again, awesome web site!
you are really a good webmaster. The site loading speed is incredible. It seems that you’re doing any unique trick. Furthermore, The contents are masterwork. you have done a magnificent job on this topic!
The best way to use our Groupon coupons is to choose the’see sale’ solution from your Lively delivers detailedandFree Coupons – Get Free Coupon Online – Store Shipping Couponfree coupons
Aw, this was a really good post. Taking a few minutes and actual effort to make a superb article… but what can I say… I put things off a whole lot and never seem to get anything done.
https://spookyswap-r-3.gitbook.io/en-us/
I抳e learn a few good stuff here. Definitely value bookmarking for revisiting. I surprise how much attempt you set to make one of these fantastic informative web site.
Greetings! This is my first comment here so I just wanted to give a quick shout out and tell you I truly enjoy reading through your blog posts. Can you recommend any other blogs/websites/forums that deal with the same topics? Appreciate it!
Looking for a great financial tool? Try Woofi Finance!
As the decentralized finance (DeFi) space continues to evolve in 2025, SpookySwap has established itself as one of the leading decentralized exchanges (DEXs) on the Fantom Opera blockchain. Known for fast, low-cost token swaps, yield farming, and liquidity rewards, SpookySwap is a powerful tool for traders and DeFi enthusiasts looking to maximize their returns while maintaining full control of their funds.
The UI, speed, and security on spooky swap are top-tier!
I love how stable and reliable spooky swap is. Never had a bad experience.
https://spookyswap-18.gitbook.io/en-us
https://spookyswap.app/
best crypto site https://iziswap.org/
https://r-guide-spookyswap-r.gitbook.io/en-us
WOOFi Finance Trading Guide: How to Trade Crypto in 2025
I am not sure where you are getting your information, but
good topic. I needs to spend some time learning more or
understanding more. Thanks for excellent info I
was looking for this information for my mission.
https://x.com/defiNews12/status/1890117978261536813, WOOFi Finance Leading DEX 2025
Your style is unique in comparison to other folks I’ve read stuff from. Many thanks for posting when you’ve got the opportunity, Guess I’ll just bookmark this blog.
I value the blog article.Thanks Again. Really Great.
I’d like to find out more? I’d love to find out more details. http://www.hairstylesvip.com
Appreciate you sharing, great post. Cool.
Some really nice and useful information on this site, as well I believe the pattern holds good features.
shark knife
I think this is a real great blog. Will read on…
I really like and appreciate your blog. Really Cool.
Discover the power of MinSwap, the leading decentralized exchange platform offering seamless trading and low fees. Maximize your assets and join the next generation of decentralized finance
Discover CowSwap, the trusted decentralized exchange platform for seamless crypto trades in 2025. With low fees, high security, and fast transactions, CowSwap is a go-to solution for DeFi users worldwide
Discover the future of decentralized finance with Woofi Finance, a cutting-edge platform for seamless crypto staking and yield farming. Maximize your returns with low fees and high rewards. Join the revolution in DeFi today!
Discover CowSwap, the trusted decentralized exchange platform for seamless crypto trades in 2025. With low fees, high security, and fast transactions, CowSwap is a go-to solution for DeFi users worldwide
stromectol ireland stromectol online pharmacy
I really liked your blog post. Really Great.
Muchos Gracias for your article.Really thank you! Fantastic.
Muchos Gracias for your article.Much thanks again. Will read on…