Authenticating using Password Credentials OAuth

Showing 1-8 of 8 messages
Authenticating using Password Credentials OAuth jwaern 6/12/12 1:03 AM

Im trying to Authenticate my application using Password Credentials OAuth (http://disqus.com/api/docs/auth/) with hardcoded username and password, here is my C# code:

string URI = "https://disqus.com/api/oauth/2.0/access_token/";
string myParameters = "grant_type=password&client_secret=[SECRET-KEY]&client_id=[PUBLIC-KEY]&scope=read,write";

WebClient wc = new WebClient();

string authInfo = "[username]" + ":" + "[password]";
authInfo
= Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
wc
.Headers["Authorization"] = "Basic " + authInfo;

wc
.Headers["ContentType"] = "application/x-www-form-urlencoded";
string HtmlResult = wc.UploadString(URI, "POST", myParameters);

This returns a 400 (Bad Request) error.It says in the disqus docs "This type of flow is restricted to approved applications only, so you must request access first.", I'm not sure if that might be the problem, but I've been unable to find a way to "request access" for my app, or is this for premium users only?

Re: [disqus-dev] Authenticating using Password Credentials OAuth David Cramer 6/12/12 10:57 AM
As the message states we limit access to this method due to security concerns.

Is there any reason you can't use a standard OAuth flow in this case?


Re: [disqus-dev] Authenticating using Password Credentials OAuth jwaern 6/13/12 12:40 AM
Hi David,
the reason I want to use this method is that we have a bunch (20ish) of administrators on one site, and I want them to be able to edit the comments without having to log in anywhere else but our admin-page.

Dunno if that's a good reason but there it is :)

/ Jens
Re: [disqus-dev] Authenticating using Password Credentials OAuth David Cramer 6/13/12 1:26 AM
Could you do the standard oauth redirect flow
Re: [disqus-dev] Authenticating using Password Credentials OAuth jwaern 6/13/12 1:32 AM
The reason I want to avoid that is that I don't want all admins to share one disqus-login but at the same time I don't want to force them all to create disqus-accounts of their own. It would be ideal for me to hardcode the login for my one account so noone has to worry about loging in / authenticating anywhere.
Re: [disqus-dev] Authenticating using Password Credentials OAuth David Cramer 6/13/12 1:35 AM
That to me days you want to share the same login, which unfortunately is not something we provide. You can achieve the same auth flow using oauth and the token, even if you share the same auth token in the app. I highly recommend registering accounts for each person though ad it will save you a lot of effort in the future
Re: [disqus-dev] Authenticating using Password Credentials OAuth jwaern 6/13/12 1:49 AM
Ok, you're right I was hoping to share one login with all my admins this way, I'll have a look at using oauth/token.

Thank you David for your time!
Re: [disqus-dev] Authenticating using Password Credentials OAuth David Cramer 6/13/12 2:14 AM
Like I said, I don't recommend it. That said, you can easily just pass the same ouath token for all users.