2020.09.01.

Xamarin.Forms Http Basic Authentication

By bence960206

What is Http Basic Authentication?

It means, that when we use an HTTPRequest GET method with some Credentials, and we wanted to earn a website trough this, but the website is protected with username and password combination.

We have to download a NuGet package, its call HTTPBasicAuthentication.

When we downloaded it, we have a new folder: HTTPBasicAuthentication. In this folder we can see how I implemented the Http Basic Authentication.

We can change the function’s return value, or everything, what we need. I made this editable, not a .dll.

Usage:

//first step: create an object

HTTPBasicAuth httpBasicImplement = new HTTPBasicAuth();

//second step: use the object

string responseString = httpBasicImplement.GetResponseString(“servername/uri”,”username”,”password”);