SAP Customer Data Cloud Positions


Skip to end of metadata
Go to start of metadata


The .NET SDK, not part of our core offering, provides a C# interface for the Gigya API. The library makes it simple to integrate Gigya services in your .NET project. This document is a practical step-by-step guide for programmers who wish to integrate the Gigya service into their .NET project. Follow the steps below to get started, and use the Library Reference while implementing.


  • The Gigya SDK requires .NET framework 3.5 or higher.
  • .NET Core is not supported.



The SDK is available for download in two forms:

  • Binary only: (add the DLL file to your project as a reference).
  • The entire project including sources.

Download your preferred package from here: 

Gigya Developer Downloads

If you are upgrading from a former version, make sure to read the SDK's Change Log.

The SDK is Strong Named, This means that the SDK's DLL is signed and you may verify its authenticity using the following Public Key:


Library Guide

Please follow these steps to integrate this library in you .NET application:

  1. Download the SDK (above).
  2. Obtain a Gigya APIKey and Secret key.
  3. Include the Gigya SDK namespace in your C# source. Add the following line of code at the beginning of the source files that use the SDK:

    using Gigya.Socialize.SDK;
  4. Log the user in.
  5. Use Gigya's API - Send Requests.
  6. Optional: Incorporate security measures.

Obtaining Gigya's API Key and Secret Key

Making API calls requires an API Key and a Secret Key which are obtained from the Dashboard section on the Gigya website. The Secret Key must be kept secret and never transmitted to an untrusted client or over insecure networks. The API Key and the Secret Key are required parameter in each request (further ahead in this document you will find guidance for sending requests).

Logging the User In

First interaction with Gigya must always be logging in. If the user is not logged in, you can not access their social profile nor perform social activities, such as setting their status. Sending requests requires an identified Gigya user (the identification of whom is performed using the UID parameter) with an active session. A user session is created when a user logs in via the Gigya service. Log users in through your client application using our Web SDK methods: socialize.login, socialize.notifyLogin, or using our ready made Login Add-on.

To learn more about the login process, see Social Login.

Sending a Request

After you have logged in the user, you may use the GSRequest class to access the user profile and perform various activities. This is implemented using GSRequest's Send method. The following code sends a request to set the current user's status to "I feel great":

// Define the API-Key and Secret key (the keys can be obtained from your site setup page on Gigya's website).
const string apiKey = "PUT-YOUR-APIKEY-HERE";
const string secretKey = "PUT-YOUR-SECRET-KEY-HERE";

// Step 1 - Defining the request
string method = "socialize.setStatus";
GSRequest request = new GSRequest(apiKey, secretKey, method, false);

// Step 2 - Adding parameters
request.SetParam("uid", "PUT-UID-HERE");  // set the "uid" parameter to user's ID
request.SetParam("status", "I feel great");  // set the "status" parameter to "I feel great"

// Step 3 - Sending the request
GSResponse response = request.Send();

// Step 4 - handling the request's response.
{    // SUCCESS! response status = OK   
	Console.WriteLine("Success in setStatus operation.");
{  // Error
	 Console.WriteLine("Got error on setStatus: {0}", response.GetLog());

Step 1: Defining the request

Create a GSRequest instance:

string method = "socialize.setStatus";
GSRequest request = new GSRequest(apiKey, secretKey, method, false);

The parameters of the GSRequest constructor are:

  1. apiKey
  2. secretKey

    Note: For instructions for obtaining these keys, see above.

  3. method - the Gigya API method to call, including namespace. For example: 'socialize.getUserInfo'. Please refer to the REST API reference for the list of available methods.
  4. Whether or not to send the request over HTTPS.

Step 2: Adding parameters

After creating the GSRequest object, use the setParam method to add parameters to the request:

request.SetParam("param1", "value1"); 
request.SetParam("param2", "value2"); 
request.SetParam("param3", "value3");

When a parameter is a complex object, use the GSObject class. See example in the Appendix below.

In the REST API reference you may find the list of available Gigya API methods and the list of parameters per each method.

Step 3: Sending the request

Execute GSRequest's Send method:

GSResponse response = request.Send();

The method returns a GSResponse object, which is handled in the next step.

By default, requests to Gigya APIs are sent using the "" domain. If your site has been set up to use another of Gigya's data centers, you must to specify that the request should be sent to that specific data center by adding the following line of code before calling the Send method:

request.APIDomain = "<Data_Center>";

Where <Data_Center>  is:
  • - For the US data center.
  • - For the European data center.
  • - For the Australian data center.
  •  - For the Russian data center.
  •  - For the Chinese data center.

If you are not sure of your site's data center, see Finding Your Data Center.

See the GSRequest documentation for more information.

Step 4: Handling the Response

Use the GSResponse object to check the status of the response, and to receive response data:

if (response.GetErrorCode()==0) {
	// SUCCESS! response status = OK   
	Console.WriteLine("Success in setStatus operation.");
else {
	// Error
	Console.WriteLine("Got error on setStatus: {0}", response.GetLog());


The GSResponse object includes data fields. For each request method, the response data fields are different. Please refer to the Gigya REST API reference for the list of response data fields per method.
For example - handling a socialize.getUserInfo response:
The response of 'socialize.getUserInfo' includes a 'user' object.

// Sending 'socialize.getUserInfo' request
GSRequest request = new GSRequest(apiKey, secretKey, "socialize.getUserInfo", false);
request.SetParam("uid", "PUT-UID-HERE");  // set the "uid" parameter to user's ID
GSResponse response = request.Send();

// Handle 'getUserInfo' response 
if (response.GetErrorCode() == 0) {  
	// SUCCESS! response status = OK
	string nickname = response.GetString("nickname", "");
	int age = response.GetInt("age", 0);
	Console.WriteLine("User name: {0}; The user's age: {1}", nickname, age);
else {
	Console.WriteLine("Got error on getUserInfo: {0}", response.GetLog());

Optional - Incorporating Security Measures

Validating Signatures

Signature validation is only necessary and supported when validating the signature of a response that was received on the client side and then passed to the server. Server-to-server calls do not contain the UIDSignature or signatureTimestamp properties in the response.

The Gigya service supports a mechanism to verify the authenticity of the Gigya processes, to prevent fraud. When Gigya sends you information about a user, your server needs to know that it is actually coming from Gigya. For that cause, Gigya attaches a cryptographic signature to the responses that include user information. We highly recommend validating the signature. The SigUtils class is a utility class for generating and validating signatures.

For example, Gigya signs the socialize.getUserInfo method response. The following code validates the signature received with the 'socialize.getUserInfo' method response:

// Handle 'getUserInfo' response 
if (response.GetErrorCode() == 0) {
	// SUCCESS! response status = OK
	// Validate the signature
	bool valid = SigUtils.ValidateUserSignature(response.GetString("UID", ""), response.GetString("signatureTimestamp", ""), secretKey, response.GetString("UIDSignature", ""));

	if (valid) {
		Console.WriteLine("signature is valid");
	else {

The parameters of the ValidateUserSignature method are:

  1. UID - the user's unique ID
  2. signatureTimestamp - The GMT time of the response in UNIX time format (i.e. the number of seconds since Jan. 1st 1970). The method validates that the timestamp is within five minutes of the current time on your server.
  3. secretKey - The key to verification is your partner's "Secret Key". Your secret key (provided in BASE64 encoding) is located at the bottom of the Dashboard section on Gigya's website (Read more above).
  4. UIDSignature - the cryptographic signature.

All the parameters, with the exception of the secretKey, should be taken from the 'User' object received with the 'getUserInfo' method response.
The method returns a Boolean value, signifying if the signature is valid or not.

In a similar fashion, when using the 'getFriendsInfo' method, The method response include a collection of 'Friend' objects. Each Friend object will be signed with a cryptographic signature. To verify the signature of a friend object, please use the ValidateFriendSignature method.

Sending Requests over HTTPS

To use Gigya service over HTTPS, all you need to do is:

When creating a GSRequest object, set the useHTTPS Boolean parameter to be true .

boolean useHTTPS = true; // send the request over HTTPS
GSRequest request = new GSRequest(apiKey, secretKey, method, useHTTPS);


Optional - Incorporating A User Or Application Key

To create an application using a User Key or Application Key,  simply pass an object using one of the alternate GSRequest Constructors instead of setting the params individually with SetParam.

string apiKey = "your-API-key"; 
string userKey = "your-user/app-key"; 
string secretKey = "your-user/app-secret"; 

// Get the user's Gigya account info 
string method = "accounts.getAccountInfo"; 

// alternate params object 
GSObject dictionaryParams = new GSObject(); 
dictionaryParams.Put("uid", "enter-UID-here"); 

GSRequest request = new GSRequest(apiKey, secretKey, method, dictionaryParams, false, userKey); 

GSResponse response = request.Send();


Appendix - Publish User Action Example

The following code sample sends a request to publish a user action to the newsfeed stream on all the connected providers which support this feature.

The socialize.publishUserAction method has a complex parameter called userAction which defines the user action data to be published. To define the userAction parameter create a GSObject object and fill it with data. There are two ways to fill the GSObject with data, you can either use the put method or construct the GSObject with a JSON string, as shown in the two examples below:

Option A - Using GSObject's put method

// Defining the userAction parameter
GSObject userAction = new GSObject();

userAction.Put("title", "This is my title");
userAction.Put("userMessage", "This is my user message");
userAction.Put("description", "This is my description");
userAction.Put("linkBack", "");

GSArray mediaItems = new GSArray();
mediaItems.Add(new GSObject("{\"src\":\"\", \"href\":\"\",\"type\":\"image\"}"));
userAction.Put("mediaItems", mediaItems);

// Sending 'socialize.publishUserAction' request
GSRequest request = new GSRequest("PUT-YOUR-APIKEY-HERE", "PUT-YOUR-SECRET-KEY-HERE", "socialize.publishUserAction");
request.SetParam("userAction", userAction); // set the "userAction" parameter
request.SetParam("uid", "PUT-UID-HERE");  // set the "uid" parameter to user's ID

// Sending 'socialize.publishUserAction' request
GSResponse response = request.Send(); 

Option B - Construct a GSObject from a JSON string

// Defining the userAction parameter 
GSObject userAction = new GSObject("{\"title\":\"This is my title\", \"userMessage\":\"This is a user message\", " +
     "\"description\":\"This is a description\", \"linkBack\":\"\", " +
     "\"mediaItems\":[ {\"src\":\"\", \"href\":\"\",\"type\":\"image\"}]}"); 

// Sending 'socialize.publishUserAction' request
GSRequest request = new GSRequest("PUT-YOUR-APIKEY-HERE", "PUT-YOUR-SECRET-KEY-HERE", "socialize.publishUserAction");
request.SetParam("userAction", userAction); // set the "userAction" parameter
request.SetParam("uid", "PUT-UID-HERE");  // set the "uid" parameter to user's ID

// Sending 'socialize.publishUserAction' request
GSResponse response = request.Send(); 

To learn more about publishing user actions, please read the Advanced Sharing guide.