Hi @AdaLi1 ,
If the content isn't public you will need to authenticate your requests with ArcGIS Identity, an API Key or an OAuth2 Token. A good introduction to security and authentication can be found here: https://developers.arcgis.com/documentation/mapping-apis-and-services/security/
If the data is on ArcGIS Online, and is not publicly shared, but you want only certain people to access it you can share it up to an Online group, or specific accounts, and then those users will need to have an ArcGIS Online login. Otherwise, if you want to handle the login and then push the data request through using a specific online account then you will have to useOAuth2 authentication as suggested by Sage.