Tag: dotnetopenauth

DotNetOpenAuth OAuth2访问额外数据

我正在使用DotNetOpenAuth的OAuth2库来处理与另一个第三方系统的授权。 这一切都很有效,除了第三方系统在使用AccessToken的Response中返回UserId =“testname”。 我需要UserId,因为这个第三方API需要它作为API调用的一部分(例如:users / {userId} / account)。 使用DotNetOpenAuth,我无法访问AccessToken响应,因此无法获取UserId。 我正在调用:( _client是一个WebServerClient)var state = _client.ProcessUserAuthorization(request); state有我的AccessToken,但没有发送的额外数据。 基于DotNetOpenAuth源代码,UserId进入库内,我没有任何访问权限。 无论如何使用DotNetOpenAuth获取UserId? 或者我是否需要放弃DotNetOpenAuth并尝试其他方法?

使用DotNetOpenAuth访问Yelp的OAuth 1.0a API

有没有人使用DotNetOpenAuth成功使用DotNetOpenAuth访问Yelp的v2 api ? 在深入了解示例和源代码之后,我就提出了这个问题: public class YelpConnector { private static readonly string YelpConsumerKey = ConfigurationManager.AppSettings[“YelpConsumerKey”]; private static readonly string YelpConsumerSecret = ConfigurationManager.AppSettings[“YelpConsumerSecret”]; private static readonly string YelpToken = ConfigurationManager.AppSettings[“YelpToken”]; private static readonly string YelpTokenSecret = ConfigurationManager.AppSettings[“YelpTokenSecret”]; private static readonly InMemoryTokenManager tokenManager = new InMemoryTokenManager(YelpConsumerKey, YelpConsumerSecret, YelpToken, YelpTokenSecret); private static readonly Uri YelpURLBase = new Uri(“http://api.yelp.com/v2/”); […]

使用DotNetOpenAuth获取FetchData?

我已经实现了这里描述的这个简单代码 (vs 2010,webforms) protected void Page_Load(object sender, EventArgs e) { var openid = new OpenIdRelyingParty(); var response = openid.GetResponse(); if (response != null && response.Status == AuthenticationStatus.Authenticated) { FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, false); } } Clickfunction: protected void btnGoogle_Click(object sender, ImageClickEventArgs e) { using (OpenIdRelyingParty openid = new OpenIdRelyingParty()) { var request = openid.CreateRequest(“https://www.google.com/accounts/o8/id”); request.RedirectToProvider(); } } 问题#1 […]

PhoneGap应用程序调用的Secure Web Api

我正在实现一些WebApi来上传/转换/返回video。 另一位开发人员将实施一个PhoneGap应用程序,该应用程序将调用我的WebApi向用户上传/转换/显示video。 PhoneGap应用程序使用OpenId允许用户使用谷歌和Facebook登录。 我的问题是,我想确保调用我的WebApi的客户端已使用谷歌或Facebook登录PhoneGap应用程序。 我知道我需要的只是客户端在请求标头中向我发送一个令牌,我可以在web api上“提取”以validation用户。 我的问题是我的WebApi如何知道PhoneGap应用程序中openId(google / fb)生成的令牌是什么?

我如何使用DotNetOpenAuth库发推文?

我刚刚下载了DotNetOpenAuth库并运行了AuthConsumer演示。 到目前为止,这是一个很棒的图书馆 一切都像宣传的一样,这与我最近一直在使用的很多Facebook和Twitter示例代码的经验不同。 我想弄清楚的是:我如何使用这个库发推文? 我目前正计划在ASP MVC中实现这一点,但我最初的想法是,演示平台在我正在看的级别上并不重要。

使用DotNetOpenAuth的双腿OAuth

我已经阅读了两条腿的OAuth,并了解其背后的原理 – 我的问题是针对DotNetOpenAuth库的。 是否有关于如何通过两条腿认证使用DotNetOpenAuth的示例代码或支持文档? 三条腿似乎得到了很好的支持,因为两条腿只是减少了步数,我认为这很容易 – 到目前为止,情况并非如此。

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

我必须弄清楚如何使用OAuth 2才能使用Deviantart api。 我得到了client_id和client_secret部分 这里是他们提供的信息 端点 使用OAuth 2.0向我们进行身份validation所需的唯一信息是您的应用的client_id和client_secret值,以及下面显示的端点。 OAuth 2.0草案10: 自由软件 url : htt OAuth 2.0草案15: 自由软件 url : htt 安慰剂电话 依赖OAuth 2.0身份validation的第一个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; 这里是deviantart提供信息的页面 http://www.deviantart.com/developers/oauth2 好了,到目前为止,我得到了什么,但没有工作 public static WebServerClient CreateClient() { var desc = GetAuthServerDescription(); […]

通过DotNetOpenAuth对FreshBooks进行身份validation

我正在尝试使用OAuth从我的ASP.NET MVC C#应用程序中对FreshBooks API进行身份validation。 这是我到目前为止: 我在这里使用DotNetOpenAuth是我在控制器操作中的代码 if (TokenManager != null) { ServiceProviderDescription provider = new ServiceProviderDescription(); provider.ProtocolVersion = ProtocolVersion.V10a; provider.AccessTokenEndpoint = new MessageReceivingEndpoint (“https://myfbid.freshbooks.com/oauth/oauth_access.php”, DotNetOpenAuth.Messaging.HttpDeliveryMethods.PostRequest); provider.RequestTokenEndpoint = new DotNetOpenAuth.Messaging.MessageReceivingEndpoint(“https://myfbid.freshbooks.com/oauth/oauth_request.php”, DotNetOpenAuth.Messaging.HttpDeliveryMethods.PostRequest); provider.UserAuthorizationEndpoint = new DotNetOpenAuth.Messaging.MessageReceivingEndpoint(“https://myfbid.freshbooks.com/oauth/oauth_authorize.php”, DotNetOpenAuth.Messaging.HttpDeliveryMethods.GetRequest); provider.TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() }; var consumer = new WebConsumer(provider, TokenManager); var response = consumer.ProcessUserAuthorization(); if (response […]

DotNetOpenId – “此消息已被处理”错误(第2部分)

这已经在这里被问到了,但我没有被提出,OP接受了一个对我没有帮助的答案。 到目前为止,我已尝试从不同的浏览器登录,更改Web配置,清除Cookie以及从外部计算机加载。 事实上,我最终确实发现问题是我自己的机器特有的; 当我发布到另一台机器时,它工作正常。 有关何处寻找解决方案的建议? 我故意使用我能想到的最简单的测试代码,一个干净的空aspx页面和一个简单的Page_Load函数。 编辑 :澄清,像原始问题的作者,我得到一个“此消息已被处理”错误。 使用Response.Write(response.Exception.ToString());将其打印到屏幕上Response.Write(response.Exception.ToString()); 。 我相信这个问题与配置相关,与其他作者不同,因为症状只出现在我的本地方框中。 请注意,症状与我是否在运行代码的同一个框上进行测试无关。 protected void Page_Load(object sender, EventArgs e) { using (OpenIdRelyingParty openid = new OpenIdRelyingParty()) { IAuthenticationResponse response = openid.GetResponse(); if (response != null) { try { Response.Write(response.Exception.ToString()); } catch (Exception) { } return; } } using (OpenIdRelyingParty openid = new OpenIdRelyingParty()) { IAuthenticationRequest request […]

claimsResponse返回Null

您好,我在asp.net中有以下代码。 我使用DotNetOpenAuth.dll for openID。 代码在 protected void openidValidator_ServerValidate(object source, ServerValidateEventArgs args) { // This catches common typos that result in an invalid OpenID Identifier. args.IsValid = Identifier.IsValid(args.Value); } protected void loginButton_Click(object sender, EventArgs e) { if (!this.Page.IsValid) { return; // don’t login if custom validation failed. } try { using (OpenIdRelyingParty openid = this.createRelyingParty()) { […]