我必须弄清楚如何使用OAuth 2来使用Deviantart API。如何使用OAuth 2 - OAuth 2 C#示例
我得到了CLIENT_ID和client_secret部分
这里的信息,他们给
端点
你需要与我们使用OAuth 2.0认证的唯一信息是您的应用程式client_id
和client_secret
值,以及下面显示的端点。
的OAuth 2.0草案10:
https://www.deviantart.com/oauth2/draft10/authorize https://www.deviantart.com/oauth2/draft10/token
的OAuth 2.0草案15:
https://www.deviantart.com/oauth2/draft15/authorize https://www.deviantart.com/oauth2/draft15/token
安慰剂呼叫
第一API调用依靠的OAuth 2.0认证是安慰剂调用。 在进行可能很长的实际API调用(如文件上载)之前,检查访问令牌是否仍然有效非常有用。 您有以下端点之一(必须提供一个访问令牌)称之为:
https://www.deviantart.com/api/draft10/placebo https://www.deviantart.com/api/draft15/placebo
您需要使用对应于您与您获得令牌的OAuth 2.0草案端点。
它总是返回以下JSON:{status: "success"}
我已经在网上搜索,发现这个真棒库。
DotNetOpenAuth V4.0.1
http://www.dotnetopenauth.net/
增加一条,作为参考,但不知道下一步怎么办。即使是一个很小的例子是有关如何使用OAuth 2
using DotNetOpenAuth;
using DotNetOpenAuth.OAuth2;
这里那里DeviantArt的给人的信息
http://www.deviantart.com/developers/oauth2
确定这里就是我有这么远,但没有工作
的页面非常有用public static WebServerClient CreateClient() {
var desc = GetAuthServerDescription();
var client = new WebServerClient(desc, clientIdentifier: "myid");
client.ClientCredentialApplicator = ClientCredentialApplicator.PostParameter("mysecret");
return client;
}
public static AuthorizationServerDescription GetAuthServerDescription() {
var authServerDescription = new AuthorizationServerDescription();
authServerDescription.AuthorizationEndpoint = new Uri(@"https://www.deviantart.com/oauth2/draft15/authorize");
authServerDescription.TokenEndpoint = new Uri(@"https://www.deviantart.com/oauth2/draft15/token");
authServerDescription.ProtocolVersion = ProtocolVersion.V20;
return authServerDescription;
}
您是否尝试过观察DNOA样本? http://www.dotnetopenauth.net/ – Mansfield 2013-02-14 13:43:11
是的,但没有工作。更新了问题 – MonsterMMORPG 2013-02-14 14:04:27