URLConnection with login

I am trying to use the URLConnection to retrieve data from a URL but it needs a login. I can view the data in a web browser because the web browser gives me the chance to enter the username and password via a pop up box (like some router/modems). The URL is https://api.cricviz.com/site/v2/match
I am using: URLConnection1.Send(“GET”, “https://api.cricviz.com/site/v2/match/”) but in the ContentRecieved event I just get a 401 error, the same as if you click on the cancel button on the login box in a web browser.
Is there any way to make it work?

Are they using this cricket API? If yes, then you find the documentation here:

and for authentication here:

No, it is their own API. The question is not realy in relation to this specific API but any that needs authentication like this. In other coding software, I can set a username and password for authentication, but I can not see how to do this with Xojo.

I did not find the documentation of their api, so I can only give a general information:

Either you add the identification as parameters to the url or you set the identification as variables in the request header.

Often it is done this way: first one requests a unique token at the beginning by setting ID and Password in the request header and then calling the Authorization route of the api. then one uses the token with any further call to the api.

See the discussion here:

or maybe better here;



Thanks, @Jason King

I didn’t think about it being a reactive event handler. I was trying to be proactive and was expecting to have to send the login in advance along with the initial connection. So I was looking for properties or methods.