When building an integration to communicate with Pearson LearningStudio we used the OAuth 1.0 module. Here is an example of how to get the authentication working:

1) Prepare all the required credentials:

request_url

consumer_key

application_id

consumer_secret

timestamp

nonce

2) Generate the timestamp. You should convert current time to seconds.

Code snippet:

long timeStamp = new Date().getTime()/1000;

3) Generate nonce, a random alphanumeric string. You can only use numbers or letters, you can’t just use letters. This nonce needs to be unique per request. Any duplicate nonce value will be rejected. The nonce must not exceed 32 characters.

Code snippet:

Random nonceGenerator = new SecureRandom();
// Any number between 0 to 999999999
long nonce = nonceGenerator.nextInt(999999999);

4) Prepare the signatureBaseString.

Code snippet:

// Method such as GET or POST in upper case

String method = method.toUpperCase();

// Prepare the resource path and encode it

String resourcePath = “/courses/10000”;

String encodedResourcePath = URLEncoder.encode(resourcePath, “UTF8”);

// Make sure that this string is URL encoded. For example ‘=’ is encoded to %3D