I’m using Azure Mobile Apps
with the .NET SDK
as a backend for my iOS app. The authentication done via Facebook. Yesterday out of nowhere (no code changes either on backend or app) the authentication with Facebook failed. The login inside the iOS client app is done via
self.client?.login(withProvider:"facebook", token: ["access_token" : FBSDKAccessToken.current().tokenString] ){ (user, error) in }
By calling this function I’m getting the following result, on the client.
Error Domain=com.Microsoft.MicrosoftAzureMobile.ErrorDomain Code=-1302 "You do not have permission to view this directory or page."
By inspecting the streaming logs of Azure Mobile Apps
, I found out that the backend gets an Unauthorized 401.71
return back from calling the Facebook Graph API.
Streaming Log:
Microsoft.Azure.AppService.Authentication Verbose: 0 : Received request: POST https://XXXXXXXXXX.azurewebsites.net/.auth/login/facebook
'w3wp.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'D:WindowsMicrosoft.NetassemblyGAC_MSILSMDiagnosticsv4.0_4.0.0.0__b77a5c561934e089SMDiagnostics.dll'. Skipped loading symbols.
'w3wp.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'D:WindowsMicrosoft.NetassemblyGAC_MSILSystem.ServiceModel.Internalsv4.0_4.0.0.0__31bf3856ad364e35System.ServiceModel.Internals.dll'. Skipped loading symbols.
Microsoft.Azure.AppService.Authentication Verbose: 0 : Calling into external HTTP endpoint GET https://graph.facebook.com/oauth/access_token.
Microsoft.Azure.AppService.Authentication Information: 0 : Sending response: 401.71 Unauthorized
I already tried cloning the Mobile App in Azure and creating a new Facebook App, without success.
3
Answers
for other users affected by this issue - I will quote the official answer from the MSDN Thread
TL;DR Hotfix applied - App Restart Required
I have the same problem, it stopped working yesterday without any code change.
I have tried to call the azure azure facebook authentication from rest client.
I get the same result as from the app, 401, and no additional information.
https://appname.azurewebsites.net/.auth/login/facebook
{
“access_token”: “token Obtained after athorizing with facebook”,
}
I have tried calling the facebook api from a rest client and it works.
https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=SECRET_APP_ID&grant_type=fb_exchange_token&fb_exchange_token=ACCESS_TOKEN
My guess is that they changed something in azure web apps and broke the facebook authentification.
Please let me know if you find any solution.
This should be rolled out now. If you have any further questions see the MSDN thread from above: https://social.msdn.microsoft.com/Forums/azure/en-US/397f6952-57bf-4c28-b383-6bba08d28f9a/facebook-login-failures-with-app-service-authentication-authorization?forum=windowsazurewebsitespreview