Socialid.login.startConnect

(Difference between revisions)
Jump to: navigation, search
(Description)
(Description)
Line 1: Line 1:
 
== Description ==
 
== Description ==
  
Opens the popup dialog to connect a new provider credential in the current login session.
+
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 [[socialid.login.init|connectType]].
  
The operation is similar to [[socialid.login.renderConnectWidget]], except for the fact that no widget will be rendered. The triggered events are the same as the widget.
+
When the [[socialid.login.init|connectType]] is set to ''"event"'', this widget can trigger the following events:
 
+
<!--
+
When the '''connectType''' is set to ''"event"'', this widget can trigger the following events:
+
 
* [[socialid.events.onConnectStart]]
 
* [[socialid.events.onConnectStart]]
 
* [[socialid.events.onConnectSuccess]]
 
* [[socialid.events.onConnectSuccess]]
Line 15: Line 12:
 
* [[socialid.events.onDisconnectError]]
 
* [[socialid.events.onDisconnectError]]
  
This widget 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 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 widget works as follows:
+
This API works as follows:
 
* if there is an user already logged in the current session, the new credential is added to the user account and the event [[socialid.events.onConnectSuccess]] is triggered.
 
* if there is an user already logged in the current session, the new credential is added to the user account and the event [[socialid.events.onConnectSuccess]] is triggered.
* if there is no user logged in the current session, a new login is created (same behavior as the [[socialid.login.renderLoginWidget|login widget]]) and the event [[socialid.events.onLoginSuccess]] is triggered.
+
* if there is no user logged in the current session, a new login is created (same behavior as the [[socialid.login.startLogin|startLogin]]) and the event [[socialid.events.onLoginSuccess]] is triggered.
  
 
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.
 
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 ==
 
== Usage ==

Revision as of 15:12, 23 November 2017

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)

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);
 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