You are here
Authenticate with Username and Password
There are two methods for authenticating to the API with a username and password: Authenticate and AuthenticateNonDefault. They both take a username and password as parameters as well as needing a valid API key. The usernames and passwords are managed in the SpringCM Address Book and are the same credentials that can be used with the SpringCM login page. The authenticate methods will create the same security context for API calls that the user has in the SpringCM user interface.
There is one difference between these two authenticate calls. AuthenticateNonDefault takes one extra parameter which is the SpringCM account ID. Users in SpringCM can belong to more than one account, so this parameter specifies the account to log into. The account ID for a given account can be found in the user interface on almost any page by looking at the aid parameter on the querystring. If the user belongs to more than one account they can specify one of the accounts as their "default" account. The Authenticate method is similar to the AuthenticateNonDefault method, except it does not take the account ID as parameter, instead it will always log onto the users default account.
Always use AuthenticateNonDefault whenever possible as the account ID will be predictable. With the Authenticate call, users can change their default account if they have more than one and can lead to unpredictable results. Only use Authenticate when you specifically want to always log onto the user's default account.