Python PyQt Zero Trust get url App

Good afternoon. I am trying to make a desktop application in python, which will by user_uгid show the list of applications available to it and launch sockets. I have everything ready except getting the list of applications. I can do this via cookie padding, but that’s not a workable option as it requires authorization and closing the browser afterwards.

In the documentation I didn’t find a way to get the list of applications

Are you looking to get a list of applications for an end user or in general?
This is the docs for listing access applications

I tried doing it with an admin token, with read access, gives an authorization error
<Response [403]>
{‘success’: False, ‘errors’: [{‘code’: 10000, ‘message’: ‘Authentication error’}]}

Can you please tell me what to put in headers and where to get this data from?

Can you share the python code you are using to make the request?

sure. i hid the token and id, but on other url’s it works, for example (//api.cloudflare.com/client/v4/user/tokens/verify)

import requests

token = “token”
identifier = ‘identifier’

headers = {
“Content-Type”: “application/json”,

"Authorization": f"Bearer {token}",

}

url = f"https://api.cloudflare.com/client/v4/accounts/{identifier}/access/apps"

response = requests.request(“GET”, url, headers=headers)
print(response)

x = response.json()
print(x)

<Response [403]>
{‘success’: False, ‘errors’: [{‘code’: 10000, ‘message’: ‘Authentication error’}]}

That code looks correct. What API permissions are assigned to the token?

good morning, reading

Reading what? It will need to be Account:Access Applications:Read

Yes, that’s what I meant

I would check that you have the right account ID being used in the code and in the API permissions because your code works fine for me.