使用Facebook iOS SDK我收到了iOS应用程序用户的access_token,它允许我查看他们的基本个人资料信息.我想使用该令牌来注册和登录我现有的Web应用程序的用户.
我不希望用户导航到account/ExternalLoginsURL并从WebView中重定向,因为此时我已经拥有了提供的访问令牌.我不明白的是我如何利用这些Acccount/RegisterExternal或Account/AddExternalLogin方法,并为他们提供这个现有的令牌和用户名/电子邮件来注册新用户.我的所有尝试都遇到了错误400或500错误.
我已经检查了很多堆栈溢出答案和博客帖子,但它们似乎是自己滚动或修改现有方法AccountController.但我不明白为什么当看起来一切都已经存在的时候,做这些事情中的任何一个都是必要的.我只是不确定如何使用它!
任何帮助将不胜感激.
编辑: 我最终使用codetrix的这个自定义解决方案.这不是我原本想要的,但到目前为止包含和工作很简单.如果有人能够回答原始问题那么请做.
我使用的是PushSharp 2.1.2版.该应用程序是.NET 4.5.1(虽然我也尝试过针对.NET 4.5和.NET 4)
我正在尝试但没有成功通过沙盒Apple APNS发送推送消息.
我使用相同的证书并使用与我的PushSharp应用程序相同的设备ID,使用Ray Wenderlich演练中提供的PHP脚本成功发送消息.
我已通过从钥匙链中导出已完成的证书p12进行测试.导出已完成的证书和密钥.导出私钥.也可以通过这里使用的方法.当我将证书和密钥结合起来用于PHP脚本时,我没有任何问题.
我已将p12证书导入到我测试过的机器上 - 似乎没有任何区别.
我已经尝试在将apple推送服务注册到推送代理时更改IsProduction标志.设置为生产时没有错误(即使这是沙盒证书),但在这种情况下它显然也无法通过设备.
我的所有消息都不会通过,所有消息都会得到如下所示的服务异常:
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted
--- End of inner exception stack trace ---
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at …Run Code Online (Sandbox Code Playgroud) Castle.Proxies.IdentityUserLogin: : EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType.
Run Code Online (Sandbox Code Playgroud)
我正在尝试为我的MVC 5.1项目设置测试,该项目使用EntityFramework版本6.1,AspNet.Identity.Core版本2.0,AspNet.Identity.EntityFramework版本2.0.我唯一的测试用例非常简单,一旦我尝试运行,它就会出现"IdentityUserLogin"和实体类型"IdentityUserRole"的错误.问题是,据我所知,这两个实体都定义了密钥!因为它们是由框架提供的.我无法在我的代码第一部分中明确地看到他们的描述,但在数据库中我可以看到他们都有密钥.
在我的测试项目中,我使用的是Microsoft.VisualStudio.TestTools.UnitTesting和Moq(以及EF和Identity Core库).
任何帮助或只是指向资源将非常感激.我找不到有类似错误的人.
我有一个通过我的ASPX站点公开的WCF服务库,如下所示
[System.ServiceModel.OperationContract]
[System.ServiceModel.Web.WebInvoke(
Method= "POST",
RequestFormat=System.ServiceModel.Web. WebMessageFormat .Json,
ResponseFormat=System.ServiceModel.Web.WebMessageFormat .Json)]
LogonResponse Logon(LogonRequest logonRequest);
[System.Runtime.Serialization.DataContract]
[ Serializable()]
public class LogonRequest
{
[System.Runtime.Serialization.DataMember]
public string EMailAddress;
[System.Runtime.Serialization.DataMember]
public string Password;
}
Run Code Online (Sandbox Code Playgroud)
在我的测试页面中,我可以通过MS Ajax调用: -
<asp:ScriptManager ID ="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/testService.svc" />
</Services>
</asp:ScriptManager>
.
.
.
function clsLogonRequest(eMailAddress, password) {
this .EMailAddress = eMailAddress;
this .Password = password;
}
function login(eMailAddress, password) {
var LogonRequest = new clsLogonRequest(eMailAddress, password);
name.API.IAPI.Logon(LogonRequest, onSuccess, onFailure);
}
function onSuccess(result) {
$( "#txtSessionId").val(result.SessionId);
$( "#txtUserName").val(result.Name);
$( …Run Code Online (Sandbox Code Playgroud) 我的目标是根据选择使3幅图像沿水平轴收缩,增长和移动.使用自动布局似乎使图像跳跃,因为他们试图实现顶级空间到superview/Bottom空间到superview约束.
所以为了解决这个问题,我把所有的图像都放在了自己的UIView中.UIView设置为图像可以增长的最大尺寸,它以水平轴为中心.所以现在所有的图像都必须保持在相应的UIView中心.这解决了我的问题,因为UIViews执行水平平移,而图像在内部收缩/增长同时保持居中.我的问题是 - 这是正确的方法吗?它似乎很长,就像我可能滥用自动布局的能力.我必须用更多的图像执行类似的任务,所以欢迎任何建议!谢谢.