- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 DotNetOpenAuth 4.1.0.12182
创建 Facebook 和 Windows LiveId 的用户登录名但是,下载中的示例使用了当前版本中不存在的 DotNetOpenAuth.ApplicationBlock
和 DotNetOpenAuth.ApplicationBlock.Facebook
。
取而代之的是 DotNetOpenAuth.AspNet.Clients
命名空间,其中包括 FacebookClient
和 WindowsLiveClient
- 但是我找不到任何示例说明如何使用这些。
是否存在任何示例或文档?
最佳答案
通过创建从 DotNetOpenAuth.OAuth2.WebServerClient 派生的 FacebookAuthClient,我已经能够让 DNOA 版本 4.1.0.12182、.Net 3.5 和 Facebook 相互协作。我发现的一个小问题是,如果您使用基于 cookie 的 session ,那么您必须在使用 OAuth 功能之前访问该 session 。据我所知,这是因为 DNOA 使用 session ID 作为状态参数,如果 session 从未被访问过,它可以在请求之间更改。当响应从 Facebook 返回时,这将导致状态参数不匹配错误。
FacebookAuthClient:
public class FacebookAuthClient : DotNetOpenAuth.OAuth2.WebServerClient
{
private static readonly DotNetOpenAuth.OAuth2.AuthorizationServerDescription Description = new DotNetOpenAuth.OAuth2.AuthorizationServerDescription
{
TokenEndpoint = new Uri("https://graph.facebook.com/oauth/access_token"),
AuthorzationEndpoint = new Uri("https://graph.facebook.com/oauth/authorize")
};
public static readonly string [] ScopeNeeded = { "publish_stream" };
public FacebookAuthClient()
: base(Description)
{
}
}
Facebook.aspx.cs:
public partial class FacebookPage : System.Web.UI.Page
{
private FacebookAuthClient _client = new FacebookAuthClient
{
ClientIdentifier = ConfigurationManager.AppSettings["FBClientId"], //The FB app's Id
ClientCredentialApplicator = DotNetOpenAuth.OAuth2.ClientCredentialApplicator.PostParameter(ConfigurationManager.AppSettings["FBClientSecret"]) // The FB app's secret
}
protected void Page_Load(object sender, EventArgs e)
{
DotNetOpenAuth.OAuth2.IAuthorizationState auth = _client.ProcessUserAuthorization();
if (_auth == null)
{
// Kick off authorization request with the required scope info
client.RequestUserAuthorization(FacebookAuthClient.ScopeNeeded);
}
}
}
这只是一个测试应用,因此没有错误处理,但它似乎可以工作。
编辑我使用 DotNetOpenAuth(统一)NuGet 包来完成所有这些。
编辑添加了缺少的 .PostParameter 调用以创建 ClientCredentialApplicator。
关于Facebook 与 DotNetOpenAuth 4.1.0.12182,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11581776/
我刚刚使用 Log4net 设置了一个日志记录提供程序,并在测试时注意到 DotNetOpenAuth 也在记录消息。他们一定也在使用 log4net,太棒了,我不希望每次有人使用 openID 登录
我正在尝试使用 DNOA 为我的应用程序提供 OpenId 支持,以便离开我迄今为止一直在使用的 Janrain 解决方案。问题是,到目前为止,我拥有的用户拥有基于个人资料的标识符(https://w
我只想使用 google 登录,并希望在我的网站上显示在用户的一般配置文件(如照片、电子邮件地址和姓名)中登录的访问权限。 DotNetOpenAuth 有可能吗? 最佳答案 这非常简单。使用 Ope
我目前正在从 Janrain engange (rpxnow) 切换到 dotnetopenauth。在我的数据库中,我将用户声明的标识符存储在表单中 https://www.google.com/a
我正在使用 Dotnetopenid 进行登录。 我正在使用 dotnetopenid 提供商登录我的应用程序(假设是 google)。 在注销时,我将通过 FormsAuthentication.S
您好, 我想将 ClaimedIdentifier 保存在数据库中。 它可以持续多久? 大概 255 个字符可以吗? 最佳答案 openid.claimed_id 仅受 URL 的最大长度限制,从技术
我刚刚开始将 DotNetOpenAuth 与 MVC 应用程序一起使用,我很难理解它的实际工作原理。 据我了解,DotNetOpenAuth 将负责使用 Google/Twitter/Faceboo
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 8年前关闭。 Improve this qu
我正在通过dotNetOpenAuth Samples (OpenIdRelyingPartyMVC 和 OpenIdProviderMvc)并提出一个问题以更好地理解...... 例如,在依赖方应用
我正在为 OpenId 提供商和依赖方实现 DotNetOpenAuth。在这两种情况下,服务器都位于负载均衡器后面,因此对于任何 HTTP 请求,我们不能假设我们会访问同一服务器。 看来 DotNe
我有一个负载均衡器,后面有一些网络服务器。到达负载均衡器的流量通过 SSL 进行保护,并且从负载均衡器到 Web 服务器的数据作为未加密的 HTTP 流量发送。我在 Web 服务器上的负载均衡器后面使
我已经下载了与http://www.dotnetopenauth.net/关联的Visual Studio 2010模板。我可以像宣传的那样使它工作。我不是从头开始一个项目,也不想花很多时间将所有we
我正在尝试使用 ASP.NET MVC 实现 OpeinID 登录。我正在尝试按照 http://blog.nerdbank.net/2008/04/add-openid-login-support-
如果您从 Github 源构建,您会在检查签名程序集时遇到错误。 是否可以只更改: SignAssembly = false DelaySign = false 在 tools\DotNetOpenA
源代码托管在哪里? git 中心?我到处都找不到它。 最佳答案 是的,它与项目的其余部分一起位于 GitHub 上。它位于 master 分支下。 https://github.com/AArnott
我使用此页面(第一个示例)提供的代码创建了一个简单页面: http://www.dotnetopenauth.net/developers/code-snippets/programmatic-ope
我有以下代码: protected void Page_Load(object sender, EventArgs e) { var openId = new OpenIdRelyingPar
我知道 stackoverflow 使用 OpenID 身份验证。我也想尝试使用它。我正在使用带有 C# 的 asp.net mvc 2.0。 我找到了这个 http://www.dotnetopen
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 5 年前。
几天来,我一直在绞尽脑汁,试图使用 DotNetOpenAuth 从 Google 获取日历列表。 我可以使用 DotNetOpenAuth 示例成功获取联系人列表。我使用 OpenId+OAuth
我是一名优秀的程序员,十分优秀!