World Geocoding Service access
Geosearch versus geocode operations
The World Geocoding Service classifies the requests you submit into one of two categories: geosearch or geocode. Geosearching can be done free of charge, but geocoding consumes credits.
Geosearching and geocoding capabalities are similar—both find locations and return them to you—the main difference is in what you do with the results. If you present the location temporarily on a map, it is a geosearch, and the operation is free. If you store the locational data, in a database for example, the operation is classified as a geocode, and is required to consume credits. Some operations are strictly geocoding operations, such as geocoding many addresses in one request (batch geocoding), because it is assumed you will always store those results.
How to perform geocoding operations
If you are going to store the results of a geocoding request, you need to include the forStorage parameter and set it to true. (The default value is false, so you don't need to specify it when performing a geosearch.) Whenever forStorage is true, providing a valid token with the token parameter is also required. Accessing services provided by Esri describes how to generate a token. Generating a valid token requires an ArcGIS Online subscription.
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 with 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
Storing credentials with the application
Authetication using the REST API
To access the secured services Esri provides, you must pass a token as a parameter in your REST requests. Accessing services provided by Esri describes this process.