Adding Connections to Social Networks

Skip to end of metadata
Go to start of metadata

Introduction

A social network connection is equivalent to an established session the current user has with a social network. A valid and active connection is required in order to perform social interaction using Gigya, such as sharing content and accessing the user's social graph.

From the user's point of view, connecting to a social network is similar to logging in, in that the user is required to provide their social network's credentials and authorize the site. However, connections are a separate concept.

The Distinction between Login and Adding Connection

Gigya's services can be divided broadly into two categories: social login and social interaction. These two categories are related but based on different concepts.

Social login is the process of identifying a person and assigning an ID in a secure, reliable and repeatable way. It ensures the same person gets the same ID every time they are authenticated. This process is a discrete operation with a clear beginning and end. It only happens when the user logs in, and does not require any long-term interaction with the user or the social login providers beyond that point in time. The Gigya API calls related to social login are socialize.loginsocialize.showLoginUIsocialize.logoutsocialize.notifyLogin, and socialize.notifyRegistration.

Social interaction is an ongoing process that requires a long-term relationship with the social network. Gigya represents this long term relationship as a connection between a social network and a user. A connection is equivalent to an established session with the social network and it may expire according to the social network's policy. A valid and active connection is required in order to perform social interaction using Gigya, such as sharing content and accessing the user's social graph. The Gigya API calls for establishing connections are socialize.addConnectionsocialize.showAddConnectionsUI and socialize.removeConnection (for terminating connections).

The actual process of logging in and adding a connection is the same for the user. In both, the user is asked to log into a social network and authorize the site. The goal, however, is very different: only a login operation authenticates the user in a way that retrieves a persistent user ID.

In Gigya, whenever a user logs in, a connection is automatically established with the login provider, if that provider supports it.

When Should You Use the "Add Connection" API Methods?

The rule of thumb is to use it when:

  • You want to add another connection to a user who is already logged in (even if that user used your own login system - as long as you called the socialize.notifyLogin API method).
  • You want to provide social services in a section of your site that does not require login. If a user logs in, their connection will be imported automatically to the user's account.

 

Best Practice: Add Connections only after Logging in

We recommend adding the Add Connections plugin to your webpages only for when the current user is logged in. You can display the Add Connections plugin instead of the Login plugin after the user logs in. This provides the logged-in user with an option to add connections to multiple social networks in order to interact with additional friends. For more information, see Social Login - Best practice implementation.

 

Adding Connections Using Social Plugins 

In addition to the Add Connections Plugin, the 'Adding Connection' operation may be initiated indirectly through the usage of one of the following plugins: Comments PluginActivity Feed Plugin, Share Plugin (each of these plugins includes an inner 'Adding Connections' UI).

Implementation - Using the Add Connections Plugin

To integrate the Add Connections Plugin, we recommend following these steps:

  1. Add the Add Connections Plugin to your site. You can integrate the Add Connections functionality in any page that requires social connectivity. The easiest method is the Add Connections Plugin wizard, which lets you customize the plugin and displays a preview. Based on your modifications, the wizard generates code that you can insert into your application. Alternatively, you may design your own user interface and call the socialize.addConnection API method.
  2. When the Gigya authentication process completes, you will be notified with an onConnectionAdded event. To learn more about how to register and handle events generated by the Gigya service, refer to the Events page. The onConnectionAdded event data will be used in the next steps.

The user is now authenticated and connected to their social network.

Next you can do the following:

Running Examples

Check out some of our Working Code Examples that use the Add Connections Plugin: