Originally posted on 4/10/2012 on the Valence Developer Blog by Craig Dunk.
When developers get started with Valence one of the first challenges is understanding how the authentication system works. This is particularly true for developers with previous experience using D2LWS SOAP calls. From a high level the IDKey Auth system in Valence is similart to a three legged OAuth style system (and similar to Google accounts or Facebook Connect)
Below is a more detailed walk through of that high level description that connect the Valence library calls with the Valence documentation (auth and api calls) and show what the user sees during each of the steps. It shows a module diagram with an area for the browser display and then shows a sequence of connections and operations. It is split into sections so that each diagram shows the user action that kicks off the sequence.
Note: The sequence below is one way to chain the calls together, but, there are number of ways that this sequence could be varied: First, the actual sequence and the use of buttons and POST operations can be adjusted to fit a different application user experience. Secondly, the steps up to where the UserID and UserKey are stored (item 15 below) can be used during an "install step" in the scenario where the application is going to use a common utility account for all the operations to the learning suite. (See the stack overflow question on utility account auth for more information). In that utility account scenario the UI would be adjusted to something like "click to install utility account" and would be run by an administrator.
In working on app sequences like the one below I would encourage you to start from one of the Getting Started Samples.
Basic App Home
Auth Start Sequence
Auth End Sequence
Making an API Call
Use of the libraries and the samples should get most of the complicated bits out of the way, but, you do need to understand this sequence in order to know how to deal with the valence login process.