Getting data from a website with auth

Hi,
Does anybody know how I would get data from a website with auth headers

I've already achieved this using python: See below

import requests

URL = 'https://api.fortnitetracker.com/v1/profile/pc/ninja'

headers = {'TRN-Api-Key' : '}
res = requests.get(URL, headers=headers)


temp_dict={}

result = res.json()['lifeTimeStats']

for r in result:
 if r['key'] == 'Wins':
 temp_dict['wins'] = r['value']
 if r['key'] == 'Kills':
 temp_dict['kills'] = r['value']
 
print(temp_dict)

All this does is ask a website for data, the website return a lot of data - see below

{
      "id": 302743522,
      "accountId": "4735ce91-3292-4caf-8a5b-17789b40f79c",
      "playlist": "p9",
      "kills": 9,
      "minutesPlayed": 0,
      "top1": 1,
      "top5": 0,
      "top6": 1,
      "top10": 0,
      "top12": 0,
      "top25": 0,
      "matches": 1,
      "top3": 1,
      "dateCollected": "2018-06-09T15:58:28.073",
      "score": 805,
      "platform": 3,
      "trnRating": 4984.2,
      "trnRatingChange": 0.83000000000001828
    },
    {
      "id": 302695404,
      "accountId": "4735ce91-3292-4caf-8a5b-17789b40f79c",
      "playlist": "p9",
      "kills": 4,
      "minutesPlayed": 0,
      "top1": 1,
      "top5": 0,
      "top6": 1,
      "top10": 0,
      "top12": 0,
      "top25": 0,
      "matches": 1,
      "top3": 1,
      "dateCollected": "2018-06-09T15:40:25.277",
      "score": 885,
      "platform": 3,
      "trnRating": 4983.4,
      "trnRatingChange": 0.69200000000000728
    },
    {
      "id": 301100697,
      "accountId": "4735ce91-3292-4caf-8a5b-17789b40f79c",
      "playlist": "p9",
      "kills": 8,
      "minutesPlayed": 0,
      "top1": 0,
      "top5": 0,
      "top6": 1,
      "top10": 0,
      "top12": 0,
      "top25": 0,
      "matches": 1,
      "top3": 0,
      "dateCollected": "2018-06-09T02:27:39.133",
      "score": 609,
      "platform": 3,
      "trnRating": 4982.7,
      "trnRatingChange": 0.35399999999999637
    },
    {
      "id": 301053716,
      "accountId": "4735ce91-3292-4caf-8a5b-17789b40f79c",
      "playlist": "p9",
      "kills": 14,
      "minutesPlayed": 0,
      "top1": 1,
      "top5": 0,
      "top6": 1,
      "top10": 0,
      "top12": 0,
      "top25": 0,
      "matches": 1,
      "top3": 1,
      "dateCollected": "2018-06-09T02:07:40.18",
      "score": 1134,
      "platform": 3,
      "trnRating": 4982.3,
      "trnRatingChange": 0.93000000000001826
    },
    {
      "id": 300994975,
      "accountId": "4735ce91-3292-4caf-8a5b-17789b40f79c",
      "playlist": "p9",
      "kills": 7,
      "minutesPlayed": 0,
      "top1": 0,
      "top5": 0,
      "top6": 1,
      "top10": 0,
      "top12": 0,
      "top25": 0,
      "matches": 1,
      "top3": 0,
      "dateCollected": "2018-06-09T01:42:06.643",
      "score": 586,
      "platform": 3,
      "trnRating": 4981.4,
      "trnRatingChange": 0.38
    },
    {
      "id": 300915868,
      "accountId": "4735ce91-3292-4caf-8a5b-17789b40f79c",
      "playlist": "p9",
      "kills": 10,
      "minutesPlayed": 0,
      "top1": 1,
      "top5": 0,
      "top6": 1,
      "top10": 0,
      "top12": 0,
      "top25": 0,
      "matches": 1,
      "top3": 1,
      "dateCollected": "2018-06-09T01:07:27.967",
      "score": 745,
      "platform": 3,
      "trnRating": 4981.0,
      "trnRatingChange": 1.0
    },
    {
      "id": 300866107,
      "accountId": "4735ce91-3292-4caf-8a5b-17789b40f79c",
      "playlist": "p9",
      "kills": 4,
      "minutesPlayed": 0,
      "top1": 1,
      "top5": 0,
      "top6": 1,
      "top10": 0,
      "top12": 0,
      "top25": 0,
      "matches": 1,
      "top3": 1,
      "dateCollected": "2018-06-09T00:46:24.64",
      "score": 858,
      "platform": 3,
      "trnRating": 4980.0,
      "trnRatingChange": 0.83200000000000729
    },
    {
      "id": 300862351,
      "accountId": "4735ce91-3292-4caf-8a5b-17789b40f79c",
      "playlist": "p9",
      "kills": 0,
      "minutesPlayed": 0,
      "top1": 0,
      "top5": 0,
      "top6": 0,
      "top10": 0,
      "top12": 0,
      "top25": 0,
      "matches": 1,
      "top3": 0,
      "dateCollected": "2018-06-09T00:44:54.26",
      "score": 32,
      "platform": 3,
      "trnRating": 4979.2,
      "trnRatingChange": -3.0
    }

And all the result = res.json just picks a certain piece of it.

So my real question, Does anybody know how to achieve this using an Arduino and a compatible internet device

See RFC2616 for the HTTP specification. Essentially, an HTTP message consists of

REQUEST LINE
HEADERS
a blank line
the request data, if any

The request line looks something like

GET /some/thing?potentially=with%20parameters HTTP/1.1

The header lines look soething like

key1=value
key2=other value

Replying to a 401 is a matter of including the correct authorization headers. The simplest is basic authorization, RFC2617. The relevant bit is:

Upon receipt of an unauthorized request for a URI within the protection space, the origin server MAY respond with a challenge like the following:

WWW-Authenticate: Basic realm=“WallyWorld”

where “WallyWorld” is the string assigned by the server to identify the protection space of the Request-URI. A proxy may respond with the same challenge using the Proxy-Authenticate header field.

To receive authorization, the client sends the userid and password, separated by a single colon (":") character, within a base64 [7] encoded string in the credentials.

basic-credentials = base64-user-pass
base64-user-pass = <base64 [4] encoding of user-pass, except not limited to 76 char/line>
user-pass = userid “:” password
userid = *<TEXT excluding “:”>
password = *TEXT

If the website your are connecting to does not accept basic authorization, then it’s a matter of finding what it does accept. This is a matter of looking at the WWW-Authenticate headers returned by the server.

Of course, there may be a library for arduino that already does all of this. I don’t know. Search the site or google to find it.