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

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

After a user is authenticated inside your user login workflow, use BVSDKManager#setUserWithAuthString() to set up the user authentication token.

πŸ“˜

The authentication token created with your existing Bazaarvoice implementation logic needs to be provided to the BVSDKManager. However, the steps to encrypt your authentication token are still applicable even if you are not a Conversations client.

Adding user information

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

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

Allowed keys such as userid, gender, and age are defined in BVAuthenticatedUser.h. This information can then be safely passed, as shown in the following example auth string.

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 BVSDKManager:

BVSDKManager.shared().setUserWithAuthString("0ce436b29697d6bc74f30f724b9b0bb6646174653d31323334267573657269643d5265636f6d6d656e646174696f6e7353646b54657374")
[[BVSDKManager sharedManager] setUserWithAuthString:@"0ce436b29697d6bc74f30f724b9b0bb6646174653d31323334267573657269643d5265636f6d6d656e646174696f6e7353646b54657374"];

After setAuthenticatedUser has been called from the BVSDKManager, 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.