Integrate Users

Models and Controllers

SC_User models Scoreloop users. Instances of SC_User have access to the unique Scoreloop user login, as well as information regarding the state of a user, for example, whether they have been authenticated on the server.

Two distinct data controllers manage the SC_User:




Retrieves a single user’s details.


Searches for users on the server. Filters search results according to some criteria.

The session user

An instance of SC_User is always available using the Scoreloop session object. This instance is referred to in the accompanying documentation as the current session user. When a Scoreloop-enabled device connects to the Scoreloop server, the current session user is automatically updated with the most recent information on the server. The session user can be accessed as below:

  1. Call SC_UserController to create a SC_User object.

  2. Load the user details with a call to SC_UserController_LoadUser(). If no user has been explicitly set, attributes for the current session user will be requested.

  3. Await a successful server response using callbacks.

  4. Access and display the retrieved user by calling SC_UserController_GetUser().

SC_Error_t errCode;
SC_Client_h client;
SC_User_h currentSessionUser;
SC_UserController_h myUserController;

//create user controller
//aCallback is the callback to be registered
errCode=SC_Client_CreateUserController(client, &myUserController, aCallback, aCookie);

//load user details

//Returns the current session user.
currentSessionUser = SC_Session_GetUser(mySession);
SC_User_h currentSessionUser;

//Returns the current session user.
currentSessionUser = SC_Session_GetUser(mySession);

Scoreloop APIs that return SC_User objects

SC_User objects can be created indirectly using a number of different methods. Along with the method outlined above, SC_User objects can be accessed through the following methods:

Scoreloop Class





Score objects that you create by invoking the class constructor are automatically associated with the current session user. Calling SC_Score_GetUser() on these score objects returns the current session user. SC_Score objects may also be retrieved from the server using SC_ScoresController. Calling SC_Score_GetUser() on these objects will return the user who submitted that particular score.


SC_Challenge_GetContender() SC_Challenge_GetContestant() SC_Challenge_GetWinner() SC_Challenge_GetLoser()

Calling SC_Challenge_GetContender() on challenge objects that are newly created returns the session user. The outcome of calling SC_Challenge_GetContestant() depends on whether the challenge is open or direct. For open challenges, calling SC_Challenge_GetContestant() returns null. For direct challenges, calling SC_Challenge_GetContestant() returns the user to whom the challenge was directly assigned. Calling SC_Challenge_GetWinner() and SC_Challenge_GetLoser() is only meaningful after a challenge is complete.



Returns the user that is explicitly associated with the controller, (by calling SC_UserController_SetUser()) If no user is explicitly set, the session user is returned instead.



Returns the list of SC_User objects that is retrieved by one of the controller's requests to the server. The list that is returned will differ according to the search criteria that you use for the controller

Last modified: 2013-12-21

comments powered by Disqus