You are here
Authenticate with User Keys
Authentication with keys allows you to connect to the API with a userkey generated by the SpringCM user interface.
SpringCM allows custom buttons to be added to the SpringCM UI's menu drop downs and toolbar. To customize the menu, log in as an administrator and then navigate to View and then Customize Menu. Next click New Menu Item and you should see a screen similar to Figure 6. Make sure to check the box labeled Add User Key to URL for SpringCM to generate a user key in the context of the logged in user and pass it on the query string. Checking the Add Selection to URL box will pass the documents or folder selected on the query string as well, as it may be needed by your third party application. After saving the configuration on this screen you may optionally choose View and then Customize Toolbar if you want your custom button to show up on the toolbar as well as the menu drop down.
When the button is clicked you will notice that a parameter named userkey is passed on the query string, which is a token as well as a second parameter called uEmail that is the current user's email address. These two parameters can be used to authenticate to the SOAP API in the context of the logged user by calling the AuthenticateWithKeys method which takes the following parameters:
- userName - This is the SpringCM username, which is the user's email address. The value of the uEmail query string parameter is passed as this parameter.
- userKey - The user key from the query string.
- apiKey - Your SpringCM API Key
The method will return a token in the context of the logged in user than can be used for subsequent API calls.
The following code sample shows how to retrieve a the userkey and uEmail parameters passed from a SpringCM custom button and use them to authenticate to the API.