User Authentication Token

This page explains how developers can authenticate authors with the Bazaarvoice Mobile SDK by submitting a user ID along with the consumer generated content.

Introduction

User IDs come from your login system, which is considered to be the authoritative (master) source for user identification. This is also referred to as "client site-auth" because it relies on your site authentication system.

After a user is authenticated inside your user login workflow, use the BVSDK instance to set up the user authentication token.

The Product Recommendations module of the Bazaarvoice Mobile SDKs support adding an authenticated user for shopper profile matching.

Adding user information

The user auth string is an encrypted query string. In the documentation above, date=2007­0527&userid=ID12345 is used as an example. This is then encrypted/signed appropriately for security. Add information such as identity and demographics in this query string, for example:

date=2007­0527&userid=ID12345&facebookId=abc123&age=28&gender=female

Allowed keys include: userid, age, email, facebookId, gender, twitterId. This information can then be safely passed to the BVSDK instance, as shown in the following example:

Refer to the Client-Mastered Authentication tutorial for detailed instructions on how to create the encrypted query string.

Setting the auth string

The example below demonstrates how to set the encrypted user auth string using the BVSDK:

BVSDK.getInstance().setUserAuthString("0ce436b29697d6bc74f30f724b9b0bb6646174653d31323334267573657269643d5265636f6d6d656e646174696f6e7353646b54657374");

After setUserAuthString has been called, Bazaarvoice will begin matching data to this user's profile. The process runs nearly in real-time, but is not instant. The Mobile SDK will poll to update the user profile and should reflect the user's interests within seconds.