Socialid.login.startConnect

From Social ID Developers
Revision as of 15:31, 23 November 2017 by Gabriel.prado (Talk | contribs)
Jump to: navigation, search

Contents

Description

Starts the social connect process for the given provider to connect a new provider credential in the current login session. Can open a popup dialog or redirect to the provider, depending on the connectType.

When the connectType is set to "event", this widget can trigger the following events:

This process allows to add credentials from different social networks to the same Social Login user. For example, an user can log in with its Facebook and add its Twitter credential, so the next time this user can choose to log in with its Facebook or Twitter account and be referenced as the same user by the website integrating with the Social Login platform.

This API works as follows:

In summary, it's important to handle these two events. In case of socialid.events.onLoginSuccess it's important to check the login token via server-side to certificate that the user logged in is the same associated to the current website session.

Usage

 socialid.login.startConnect(provider, options)

Parameters

provider required Determines which provider will be used in the connect process. Can be "facebook", "twitter", "linkedin" or "gplus".

Example

It opens a popup starting the login dialog with Facebook when the user clicks on the "facebook_connect" button:

 socialid.login.init(1, {connectType: "event"});
 facebook_button = document.getElementById("facebook_connect");
 facebook_button.onclick = function() {
   socialid.login.startConnect("facebook");
 };

You can test this parameters in our playground: https://sid-examples.herokuapp.com/social_logins/playground

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox