Socialid.login.startLogin

(Difference between revisions)
Jump to: navigation, search
(Description)
(Parameters)
Line 41: Line 41:
 
| width="200px" | optional
 
| width="200px" | optional
 
| Overrides [[socialid.login.init|scope]] parameter
 
| Overrides [[socialid.login.init|scope]] parameter
 +
|+
 +
! align="left" width="200px" style="padding-left: 20px" | errorRedirect
 +
| width="200px" | optional
 +
| Overrides [[socialid.login.init|errorRedirect]] parameter
 
|}
 
|}
  

Revision as of 20:03, 14 May 2018

Contents

Description

Starts the social login process for the given provider. Can open a popup dialog or redirect to the provider, depending on the loginType.

Event Login Type

When the loginType is set to "event", this method can trigger the following events:

Redirect Login Type

When the loginType is set to "redirect", the user is redirected via HTTP POST to the redirect URI after the login succeeds. The login_token is passed along as the token POST parameter.

Callback Login Type

When the loginType is set to "callback", the API opens a popup and behaves just like the "event" loginType until the end of the login process. All login events can also be generated. However, at the end of a successful login, the user is redirected to the redirect URI following the same flow described for the "redirect" loginType.

Usage

 socialid.login.startLogin(provider, options)

Parameters

provider required Determines which provider will be used in the login process. Can be "facebook", "twitter", "linkedin" or "gplus".
options optional A Javascript object containing additional parameters.
redirectURI optional Overrides loginRedirectURI parameter
scope optional Overrides scope parameter
errorRedirect optional Overrides errorRedirect parameter

Example

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

 socialid.login.init(1, {loginType: "event"});
 facebook_button = document.getElementById("facebook_login");
 facebook_button.onclick = function() {
   socialid.login.startLogin("facebook");
 };

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

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox