Good morning
my aim is to integrate facebook authentication with my mobile application that i made with xamarin form.
For this purpose I followed this procedure:
https://devblogs.microsoft.com/xamarin/authentication-xamarin-essentials-aspnet/
The web api part, on the other hand, is made using NET Core 3.
I created my application from
https://developers.facebook.com/
At first I had problems with the lack of domain.
I was accessing the web api directly via the ip address and without https and this gave me problems.
Now I have fixed these problems but it is not clear how the return callback should be handled.
I did as written in the documentation
var callbackUrl = new Uri ("myapp://"); r = await WebAuthenticator.AuthenticateAsync (authUrl, callbackUrl);
Actually this callBackurl is IGNORED and the url that is called is the default callback url which is:
https://www.mywebapi.eu/signin-facebook?code=xxxxxxx
This page is not present in my web api project and therefore it all ends with a sad 404 error.
in the example it is not clear if a signin-facebook control should be created.
I would have expected the callback to call my app again and have permission to read the necessary user information.
async Task OnAuthenticate(string scheme) { try { WebAuthenticatorResult r = null; if (scheme.Equals("Apple") && DeviceInfo.Platform == DevicePlatform.iOS && DeviceInfo.Version.Major >= 13) { r = await AppleSignInAuthenticator.AuthenticateAsync(); } else { var authUrl = new Uri(authenticationUrl + scheme); var callbackUrl = new Uri("myapp://"); r = await WebAuthenticator.AuthenticateAsync(authUrl, callbackUrl); } AuthToken = r?.AccessToken ?? r?.IdToken; } catch (Exception ex) { AuthToken = string.Empty; await DisplayAlertAsync($"Failed: {ex.Message}"); } }