相关疑难解决方法(0)

如何使用OAuth 2 - OAuth 2 C#示例

我必须弄清楚如何使用OAuth 2才能使用Deviantart api.

我得到了client_id和client_secret部分

这里是他们提供的信息

端点

您使用OAuth 2.0向我们进行身份验证所需的唯一信息是您的应用的值client_idclient_secret值,以及下面显示的端点.

OAuth 2.0草案10:

自由软件 网址:htt

OAuth 2.0草案15:

自由软件 网址:htt

安慰剂电话

依赖于OAuth 2.0身份验证的第一个API调用是安慰剂调用.在进行可能很长的真实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;
Run Code Online (Sandbox Code Playgroud)

这里是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 …
Run Code Online (Sandbox Code Playgroud)

c# oauth dotnetopenauth oauth-2.0

10
推荐指数
1
解决办法
7万
查看次数

标签 统计

c# ×1

dotnetopenauth ×1

oauth ×1

oauth-2.0 ×1