OAuth is a complicated topic to wrap your head around when you do attempt it for the first time, but i can recommend digging into it deeper if you plan to ever do scripting with any API that requires authentication later on.
The general Idea of OAuth is that an “application” (in this case, you or your script) is granted access to certain elements of someone’s account or to execute actions for someone. These actions or pieces of info are controlled by “scopes”, basically telling the first party (Twitch, in this case) “Hey, i want to be able to access the following resources for this user”.
This then prompts the user (usually by opening a URL in their Browser) to log in or otherwise verify their identity so they can confirm that the application may request the mentioned scopes.
Depending on the selected authorization flow, the user then gets redirected to your redirect URL - What Dist linked uses the Authorization Code flow, so a code (NOT an Oauth token!) is passed along with the URL the user is redirected to. This code then needs to be exchanged for a token.
This is then done as described in the docs by sending a POST request to https://id.twitch.tv/oauth2/token with the appropriate parameters. In the response to this request, you will finally get the OAuth token that you can use for the above mentioned YYYYYY.
Specially to note is how long the token is valid - you’ll have to effectively repeat this procedure once the token expires. You could also refresh it as mentioned here.
Hope this helps a bit more to understand the topic!