In order to access the ArcGIS Online network analysis services, you will need an ArcGIS Online subscription. Once you have a subscription, you can create named users that can access your subscription. Each successful request to the services incurs service credits which are debited from your subscription based on the service used and the results returned from the service. The ArcGIS Online service credits page provides details about service credits for different network analysis services.
This help topic describes how to connect the applications you create to the ArcGIS Online network analysis services. If you want to connect through ArcMap instead, read Connecting ArcMap to ArcGIS Online network analysis services.
Providing authentication credentials to ArcGIS Online
As a developer, you can provide authentication credentials in one of two ways: by prompting end users to enter their authenticated login or by storing credentials within the application.
Prompting end users to sign in
You can use the Identity Manager component in the client APIs to manage the login process. The Identity Manager simplifies the process of working with secure resources. It handles the process of prompting the user for their credentials, generating a token, and appending it to the request.
Similar facilities are available in the other client APIs.
Storing credentials within the application
Authentication using the REST API
To access the secured services Esri provides, you pass a token as parameter in your REST requests. Accessing services provided by Esri describes this process.