Forum Xamarin Xamarin.Forms

How to make a http get from Secured API with google account connection

Bigoudi88Bigoudi88 Member ✭✭


I did an api, for the exemple i will call it: https://

I did the Authentication / Authorization in Azure for google Facebook and Microsoft account.

Then i want to consume it in xamarin for my Android/iOS app, so i did the login button etc but when I'm authentify i can't get the json of my api URL: "https://".

It work's perfectly in my browser and in postman... This is my code in C#:
var requestCoord = new OAuth2Request("GET", new Uri(URL),null , e.Account); var responseCoord = await requestCoord.GetResponseAsync(); //it works for google userinfo but not for my Api... string coordJson = await responseCoord.GetResponseTextAsync(); var mapTest = JsonConvert.DeserializeObject<List<CustomPin>>(coordJson);

I got a message : System.Net.HttpStatusCode.Unauthorized for the var responseCoord .

If you have any idea to make this Http Get from protected webapi i will help me so much !!!

Thanks a lot

If you need more precision let me know;)
I use this tuto to be authentify : https:// and https://

Sign In or Register to comment.