Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6355011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:40:50+00:00 2026-05-24T22:40:50+00:00

I am working on consuming the Instagram API and I am stuck at step

  • 0

I am working on consuming the Instagram API and I am stuck at step 2 of their OAuth. I have a code from their redirect back to me, but then they want me to do a post with parameters like below…

curl \
    -F 'client_id=CLIENT-ID' \
    -F 'client_secret=CLIENT-SECRET' \
    -F 'grant_type=authorization_code' \
    -F 'redirect_uri=YOUR-REDIRECT-URI' \
    -F 'code=CODE' \
    https://api.instagram.com/oauth/access_token

I am implementing this as an ASP.NET MVC 3 solution. I tried to implement the post like so…


    WebRequest request = HttpWebRequest.Create("https://api.instagram.com/oauth/access_token");
    request.Method = "POST";
    request.Headers.Add("client_id", "sdlf0982jiejfopijfp92jjiwoijf90");
    request.Headers.Add("client_secret", "39993939393939393939393939393");
    request.Headers.Add("grant_type", "authorization_code");
    request.Headers.Add("redirect_uri", "http://localhost:34962/Home/Auth");
    request.Headers.Add("code", 111111);
    var response = request.GetResponse();
    return View();

This gives me a 400 error saying that "client_id is required". I have included the client_id, but I'm clearly not implementing this correctly.

What is the "best practice" way to perform the second leg of the OAuth?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:40:51+00:00Added an answer on May 24, 2026 at 10:40 pm

    I got the answer from the above mentioned SO post about adding POST parameters to an HttpWebRequest. Here are the details of my implementation.

    NameValueCollection parameters = new NameValueCollection();
    parameters.Add("client_id", "3498wjfoi2892jf0j2ij02fjakjf2");
    parameters.Add("client_secret", "392621gfdlfj2k2hf7g2lfhj2g");
    parameters.Add("grant_type", "authorization_code");
    parameters.Add("redirect_uri", "http://localhost:34962/Home/Auth");
    parameters.Add("code", code);
    
    WebClient client = new WebClient();
    var result = client.UploadValues("https://api.instagram.com/oauth/access_token", parameters);
    
    var response = System.Text.Encoding.Default.GetString(result);
    
    return View("Index", (object)response);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code for consuming a service that is not working for
I'm working with a team and have to read to understand their codes. I
I created an API wrapper class library for consuming a rest API from a
I'm consuming a webservice from another company, they have multiple versions running, each newer
working in .net mvc I have a jQuery plugin consuming a List column for
I am working on a WPF application. I have a time consuming method that
I am working on a web application that is consuming a Dataset returned by
I'm working with some code that is confusing me and I'm wondering if I'm
Working on a project at the moment and we have to implement soft deletion
Working on a project that parses a log of events, and then updates a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.