If you have services that require authentication but you don't want your users to sign in, the best approach is to have your application handle the authentication for you. You do this by either setting up a proxy on your own server, or use a proxy service hosted by AGOL.
The first step is to create the actual application and register it with AGOL or your own portal. This can be done directly in AGOL or via the Developers site. If you are uncertain how, you can also try it by adding an item directly in AGOL by following the section for "Add Apps" in http://doc.arcgis.com/en/arcgis-online/share-maps/add-items.htm. This does the same thing as what is described in https://developers.arcgis.com/documentation/core-concepts/security-and-authentication/accessing-arcgis-online-services/.
Once the application is registered, you will need to take note of the client id and secret. This can be seen analogous to a username/password. These credentials would need to be stored in a proxy file that you have accessible (and also locked down) on your own server. More information on these proxies can be found at https://github.com/Esri/resource-proxy.
If you do not wish to host your own proxy file, you can use the hosted proxies. For example, let's say you are working with the route task which requires credentials. You can use use a hosted proxy service for the route task and reference that URL. More information on the proxy services an be found at https://developers.arcgis.com/documentation/core-concepts/security-and-authentication/working-with-proxies/.