Tag: azure mobile services

MS Azure – 错误请求400

每次运行这行代码时,我都会收到错误的请求错误: List accounts = await App.accountTable.Where(account => account.EmailAddress == email).ToListAsync(); 这是错误消息: A first chance exception of type ‘Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException’ occurred in mscorlib.dll Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException: The request could not be completed. (Bad Request) at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.d__18.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient.d__1d.MoveNext() […]

解码Azure移动服务JWT令牌时出现JwtSecurityTokenexception

以下代码: using System.IdentityModel.Tokens; JwtSecurityToken jwtSecurityToken = new JwtSecurityToken(rawToken); 生成以下exception: Jwt10113: Unable to decode the ‘header’ The value “0” is not of type “System.String” and cannot be used in this generic collection. Parameter name: value 当rawToken的’header’部分是: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6MH0 哪个可以解码为: {“alg”:”HS256″,”typ”:”JWT”,”kid”:0} 错误令牌的来源是Azure Mobile Services 。 请注意,调用同一行代码时不会发生exception,而’header’部分是: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjAifQ 哪个可以解码为: {“alg”:”HS256″,”typ”:”JWT”,”kid”:”0″} 我如何克服这个问题,并正确validation这样的令牌?

用于Azure移动服务(REST)的实时连接身份validation令牌

我有一个简单的Windows窗体应用程序来尝试Live Connect和Azure移动服务。 不是Windows 8现代应用程序。 我正在尝试使用Live Connect的一些示例代码,并且能够使登录部分正常工作。 最后,我在登录后获得了access_token。 在同一Windows窗体应用程序的移动服务端,我正在尝试使用REST登录。 但是,我希望获得“401 Unauthorized”响应,因为“身份validation令牌的签名格式错误或由其他密钥签名” JWT好像有两个’。’ 在令牌中。 SWT似乎有’/’,’+’和’=’ 我需要进行转换吗? 有没有办法配置Live Connect,以便返回的身份validation令牌是JWT(或移动服务所期望的)? 我在Live Connect和Mobile Services上都检查了客户机密码,它们是正确的。

访问其他Twitter用户信息

我正在使用Azure移动服务来授权用户,现在我正在尝试从提供商处获取其他用户信息。 除了Twitter之外,我还为所有人工作。 要对所有其他人进行身份validation,我使用类似于此的内容: var identities = await user.GetIdentitiesAsync(); var result = new JObject(); var fb = identities.OfType().FirstOrDefault(); if (fb != null) { var accessToken = fb.AccessToken; result.Add(“facebook”, await GetProviderInfo(“https://graph.facebook.com/me?access_token=” + accessToken)); } 我可以做这样的事情: var tw = identities.OfType().FirstOrDefault(); if (tw != null) { var accessToken = tw.AccessToken; var accessTokenSecret = tw.AccessTokenSecret; result.Add(“twitter”, await GetProviderInfo(“https://api.twitter.com/1.1/account/verify_credentials.json?token=” + accessToken […]

如何确定我是否在Windows Phone 8.1(通用应用程序)中连接到WiFi或移动网络?

我正在使用Windows Universal应用程序(Windows 8.1和Windows Phone 8.1之间的共享后端,而不是Silverlight)。 该应用程序通过Azure移动服务连接到Azure。 在应用程序的设置中,我希望只有通过WiFi网络才能进行同步选项。 如何确定手机是连接到WiFi还是移动网络? 虽然从我的研究中我已经找到了使用旧版Windows Phone和Silverlight的方法,但似乎我只能确定该设备是否在Windows Universal应用程序中连接到互联网。

在WebApi服务中validationAzure移动服务令牌

我正在尝试在使用WebApi服务的跨平台移动应用程序上实现身份validation和身份validation。 我的计划是将身份validation导出到联合云服务,例如新的Azure移动服务。 客户端移动应用程序将使用移动服务身份validation流程,获取令牌,而不是将请求的头部发送到WebApi,然后WebApi将对其进行validation并从中提取UserId。 假设我已经使用DelegatingHandler拦截器配置了WebApivalidationJWT令牌,是否可以validationAzure移动服务发布的令牌? SymmetricKey,Issuer和Audience的正确值是什么? 我正朝着正确的方向前进吗?

如何忽略默认的EntityData属性?

我正在使用Entity Framework创建MVC mobile application service 我创建了一个Entity Model如下所示: public class Regions : EntityData { public string Id { get; set; } public string Name { get; set; } } 我已经创建了一个TableController所以我通过发出一个get请求来查询: http://localhost:3000/tables/Regions 这会返回错误说: “exceptionMessage”:“无效的列名’Id’。\ r \ n无效的列名>’版本’。\ r \ n无效的列名’CreatedAt’。\ r \ n无效的列名’UpdatedAt’。”, 查看EntityData类,我可以看到这些是EntityData类的属性: public abstract class EntityData : ITableData { protected EntityData(); [DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Index(IsClustered = true)] […]

Azure移动服务C#不会返回子实体

我真的用新的基于C#的Azure移动服务打砖墙了,它也非常简单:(我不能为我的生活得到查询操作来返回子属性值。我有todo项目的默认项目修改如下: public class TodoItem : EntityData { public TodoItem() { this.Numbers = new Collection(new List { new TodoItemNumbers{Value = 1}, new TodoItemNumbers{Value = 2}, new TodoItemNumbers{Value = 3}, new TodoItemNumbers{Value = 4}, new TodoItemNumbers{Value = 5}, }); } public virtual ICollection Numbers { get; set; } public string Text { get; set; } public bool […]