I have followed the documentation at https://docs.microsoft.com/en-gb/azure/active-directory/develop/tutorial-v2-asp-webapp and successfully created the web application and deployed to Azure. My application needs to get IP and geolocation of the logged-in user. I am using https://ip-api.io/json/ and http://checkip.dyndns.org/ to get these information. I am doing webclient calls to fetch the data:
WebClient client = new WebClient();
string jsonstring = client.DownloadString(url);
return jsonstring;
This is working when I run the code using IE but fails when using Chrome, Firefox and IE in Private browsing. I get the Microsoft screen to enter my email address and password but then get the error message "We couldn't sign you in. Please try again." If I comment the code which is calling these external links, I am able to login.
I am not sure what is causing this behaviour and any help will be greatly appreciated.
Thanks
I found the solution by making use of optional claims: "idToken": [ { "name": "ipaddr", "essential": false, "additionalProperties": []
} ]
This should be added in the app's manifest on Azure.
More details at https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-optional-claims
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.