WebAPI Facebook login returning Access Denied when removing permissions

前端 未结 1 1005
-上瘾入骨i
-上瘾入骨i 2021-01-25 10:03

I have a client app (written with Xamarin) for iOS and WP which uses a WebAPI with Facebook as the sole method of logging in. My issue is that when a user customises the require

1条回答
  •  悲哀的现实
    2021-01-25 10:30

    Found it...

    In the OnAuthenticated method in Startup.auth.cs, you have access to the USER access token. Here you can check facebook permissions granted by accessing the graph api with the token, and remove the app if needed.

    The method was failing because context.email was null;

    context.Identity.AddClaim(new System.Security.Claims.Claim("urn:facebook:email", context.Email, ClaimValueTypes.Email, "Facebook"));
    

    0 讨论(0)
提交回复
热议问题