此博客将引导您完成如何解决该问题:http ://www.thejoyofcode.com/Setting_the_auth_token_in_the_Mobile_Services_client_and_caching_the_user_rsquo_s_identity_Day_10_.aspx
您将不得不手动“登录用户”,而不是使用提供的登录方法。为此,请在移动服务客户端实例上设置用户对象。(有关生成身份验证令牌的更多信息,请查看此处:http ://www.thejoyofcode.com/Generating_your_own_ZUMO_auth_token_Day_8_.aspx )
在 C# 中:
var mobileServiceClient = new MobileServiceClient("<your-app-url>", "<your-app-key>");
mobileServiceClient.CurrentUser = new MobileServiceUser("Foo:123456789");
mobileServiceClient.CurrentUser.MobileServiceAuthenticationToken = "<your-users-JWT>";
在 JS 中:
var client = new Microsoft.WindowsAzure.MobileServices.MobileServiceClient(
"<your-app-url>",
"<your-app-key>");
client.currentUser = {
userId: "Foo:123456789",
mobileServiceAuthenticationToken: "<your-users-JWT>"
};