Getting Oauth Token

Then you need to generate and store then use an app access token. As covered in the oAuth docs I already linked.

Then pass that token with your request.

An example is on this other Post that is doing similar to what you are doing

But it’s not the recommended solution as this generates an oAuth token every time rather than reusing an old still valid one.