Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
access_token error: missing param 'grant_type'
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Vinney K  
View profile  
 More options Jun 29 2012, 5:11 pm
From: Vinney K <vinn...@live.com>
Date: Fri, 29 Jun 2012 14:11:08 -0700 (PDT)
Local: Fri, Jun 29 2012 5:11 pm
Subject: access_token error: missing param 'grant_type'

I am trying to implement OAuth 2.0 to enable the creation of threads via
the Disqus API. However, I can't seem to get this working. I keep receiving
a 400 response specifying
{"error_description": "Missing required parameter: grant_type", "error":
"invalid_request"}.

Here is an example of the request:

POST
/api/oauth/2.0/access_token/?client_id=...&client_secret=...&grant_type=aut horization_code&redirect_url=...&code=... HTTP/1.1

Can anyone please help determine what I'm doing wrong? I've lost most of my
day to trying to uncover the mysteries of this error. For what I can tell,
I'm doing what the API doucmentation has explained.

Thanks,
Vinney


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marcor  
View profile  
 More options Jul 2 2012, 7:19 am
From: Marcor <marco...@gmail.com>
Date: Mon, 2 Jul 2012 04:19:47 -0700 (PDT)
Local: Mon, Jul 2 2012 7:19 am
Subject: Re: access_token error: missing param 'grant_type'

I've the same problem in C# (Windows 8) with this code:

HttpClient client = new HttpClient();

string str =
"https://disqus.com/api/oauth/2.0/access_token/?grant_type=password&cl...";

client.DefaultRequestHeaders.Authorization =
System.Net.Http.Headers.AuthenticationHeaderValue.Parse("Basic ...");

HttpResponseMessage res = await client.PostAsync(str, null);

return await res.Content.ReadAsStringAsync();


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vinney K  
View profile  
 More options Jul 2 2012, 11:41 am
From: Vinney K <vinn...@live.com>
Date: Mon, 2 Jul 2012 08:41:51 -0700 (PDT)
Local: Mon, Jul 2 2012 11:41 am
Subject: Re: access_token error: missing param 'grant_type'

@Marcor,

According to this thread (
https://groups.google.com/forum/?fromgroups#!topic/disqus-dev/S6SavcJ...)
you need to post the values via the request body rather than the
querystring. That said, I've still not been able to get that working
either; instead I get a new error about an invalid API version. I wont be
back on that until tonight but I'll let you know if/when I figure it out.
Hopefully you'll let me know if you beat me to the punch.

BTW, it's nice to see another .NET dev in this anti-.net world! Sexy
async/await too!

Vinney


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marcor  
View profile  
 More options Jul 3 2012, 10:23 am
From: Marcor <marco...@gmail.com>
Date: Tue, 3 Jul 2012 07:23:49 -0700 (PDT)
Local: Tues, Jul 3 2012 10:23 am
Subject: Re: access_token error: missing param 'grant_type'

Thanks :)

this is the solution:

HttpClient client = new HttpClient();

client.DefaultRequestHeaders.Authorization =
System.Net.Http.Headers.AuthenticationHeaderValue.Parse("Basic " + base64);

var postData = new List<KeyValuePair<string, string>>();
postData.Add(new KeyValuePair<string, string>("grant_type", "password"));
postData.Add(new KeyValuePair<string, string>("client_secret",
App.SECRETKEY));
postData.Add(new KeyValuePair<string, string>("client_id", App.APIKEY));
postData.Add(new KeyValuePair<string, string>("scope", "read,write"));
HttpContent content = new FormUrlEncodedContent(postData);

HttpResponseMessage res = await client.PostAsync("
https://disqus.com/api/oauth/2.0/access_token/", content);

Il giorno luned́ 2 luglio 2012 17:41:51 UTC+2, Vinney K ha scritto:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »