问题
I am trying to setup development environment to integrate Google sign-in on Android using Web Authenticator in Xamarin Essentials.
In the Web API project, same
AuthController
is included described in this article. It is running on https://localhost:44311/apiTo call the API from emulator, API url is referenced as https://10.0.2.2:43411/api as described in this article.
Now, I am able to call the API url using
await WebAuthenticator.AuthenticateAsync(apiUrl, callbackUrl)
But, when API tries to invoke Google authentication via
await Request.HttpContext.ChallengeAsync(scheme);
, below error is returned from Google.
Error 400: invalid_request, device-id and device-name are required for the private IP: https://10.0.2.2:4311/signin-google
As I understand, it is expecting request originated from the server instead of IP address like
https://<servername>
Whole situation comes down to be able to access the webservice using name (or localhost) to be used in both emulator and Google redirect uri.
来源:https://stackoverflow.com/questions/61905112/setup-web-authenticator-in-xamarin-essentials-for-local-android-development