Setup Web Authenticator in Xamarin Essentials for local Android development

Viewed 1504

I am trying to setup development environment to integrate Google sign-in on Android using Web Authenticator in Xamarin Essentials.

  1. In the Web API project, same AuthController is included described in this article. It is running on https://localhost:44311/api

  2. To call the API from emulator, API url is referenced as https://10.0.2.2:43411/api as described in this article.

  3. Now, I am able to call the API url using await WebAuthenticator.AuthenticateAsync(apiUrl, callbackUrl)

  4. 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

  1. As I understand, it is expecting request originated from the server instead of IP address like https://<servername>

  2. 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.

0 Answers
Related