2016-06-25 42 views
0

我正在測試Azure雲移動應用程序,並下載了入門部分提供的示例應用程序。我還配置了用於認證的Azure Active Directory。Azure iOS應用程序身份驗證錯誤

當我運行在iOS模擬器的應用程序,我在終端說法得到一個錯誤:

ERROR Error Domain=com.Microsoft.MicrosoftAzureMobile.ErrorDomain Code=-1302 "You must be logged in to use this application" UserInfo={com.Microsoft.MicrosoftAzureMobile.ErrorResponseKey= { URL: https://appname.azurewebsites.net/tables/TodoItem } { status code: 401, headers { "Content-Length" = 45; "Content-Type" = "text/html; charset=utf-8"; Date = "Sat, 25 Jun 2016 10:46:04 GMT"; Etag = "W/\"2d-vonn2FgYR/Z6jU4A0udEWA\""; Server = "Microsoft-IIS/8.0"; "Set-Cookie" = "ARRAffinity=155c1827c98c621a5b3208e361587e118813cc4207f5ad4c23e121c5c10fd7bf;Path=/;Domain=appname.azurewebsites.net"; "X-Powered-By" = "Express, ASP.NET"; } }, NSLocalizedDescription=You must be logged in to use this application, com.Microsoft.MicrosoftAzureMobile.ErrorRequestKey= { URL: https://appname.azurewebsites.net/tables/TodoItem }} Error: Error Domain=com.Microsoft.MicrosoftAzureMobile.ErrorDomain Code=-1173 "Push aborted due to authentication error" UserInfo={NSLocalizedDescription=Push aborted due to authentication error, NSUnderlyingError=0x7f84fb1bd910 {Error Domain=com.Microsoft.MicrosoftAzureMobile.ErrorDomain Code=-1302 "You must be logged in to use this application" UserInfo={com.Microsoft.MicrosoftAzureMobile.ErrorResponseKey= { URL: https://appname.azurewebsites.net/tables/TodoItem } { status code: 401, headers { "Content-Length" = 45; "Content-Type" = "text/html; charset=utf-8"; Date = "Sat, 25 Jun 2016 10:46:04 GMT"; Etag = "W/\"2d-vonn2FgYR/Z6jU4A0udEWA\""; Server = "Microsoft-IIS/8.0"; "X-Powered-By" = "Express, ASP.NET"; } }, NSLocalizedDescription=You must be logged in to use this application, com.Microsoft.MicrosoftAzureMobile.ErrorRequestKey= { URL: https://appame.azurewebsites.net/tables/TodoItem }}}}

儘管如此,應用程序是工作,我可以節省的項目和加載數據。我如何解決以下問題?

+0

你是如何配置後端的?您是否將認證/授權默認操作設置爲「允許請求」? (這是必需的,以便應用程序控制auth而不是前端處理器) –

回答

1

該應用程序可能似乎工作,因爲它將項目保存到本地數據庫,但嘗試同步時出現錯誤。我猜你在配置時在服務級別配置了身份驗證。您可以通過將「請求未通過身份驗證時採取的操作」下的身份驗證/授權中的設置更改爲「允許請求(無操作)」,將其更改爲僅針對特定終端所需。請參閱How authorization works in App Service

對於確實需要驗證的端點,您需要添加代碼以登錄客戶端。請參閱Add authentication to your iOS app

相關問題