Socialid.login.init

(Difference between revisions)
Jump to: navigation, search
(Parameters)
(Description)
Line 8: Line 8:
 
* callback: the Social Login is performed in a popup and at the end of the process the web page is redirected to the callback url configured in the Social Login dashboard. Intermediate login events are generated.
 
* callback: the Social Login is performed in a popup and at the end of the process the web page is redirected to the callback url configured in the Social Login dashboard. Intermediate login events are generated.
 
* redirect: the Social Login is performed via redirects in the following order: website > socialid > social network > socialid > website callback. Popup is not used in this case. This option is useful for places where the browser is limited and cannot use popups.
 
* redirect: the Social Login is performed via redirects in the following order: website > socialid > social network > socialid > website callback. Popup is not used in this case. This option is useful for places where the browser is limited and cannot use popups.
 +
 +
The callback url used in the login types "callback" and "redirect" could be customized per request using the "redirectURI" option.
  
 
== Usage ==
 
== Usage ==

Revision as of 03:58, 30 July 2016

Contents

Description

Initializes the API to be used by a Social Login application. It's required to call this function to unlock the other Social Login APIs.

This function takes an important option: the loginType. This option controls how the Social Login flow is executed in the browser. You can configure the loginType with one of these values:

  • event: the Social Login is performed in a popup and all the steps generate Javascript events. The browser is not redirect to any location, you should handle the login success through socialid.events.onLoginSuccess.
  • callback: the Social Login is performed in a popup and at the end of the process the web page is redirected to the callback url configured in the Social Login dashboard. Intermediate login events are generated.
  • redirect: the Social Login is performed via redirects in the following order: website > socialid > social network > socialid > website callback. Popup is not used in this case. This option is useful for places where the browser is limited and cannot use popups.

The callback url used in the login types "callback" and "redirect" could be customized per request using the "redirectURI" option.

Usage

 socialid.login.init(appId, options)

Parameters

appId required The identifier number of the Social Login application.
options optional A Javascript object containing additional parameters.
loginType optional Define how the Social Login will be performed in the browser (see the description above). Can be "callback", "event" or "redirect". Default: "event".
redirectURI optional Define the callback url that must be called after the user logs in. Applied only to loginType "callback" or "redirect". If no redirectURI is defined, the default callback configured in the Social Login is used. The redirectURI domain must be allowed in the Social Login domains whitelist.

Example

This example initializes the Social Login API to be used by the application with id "1" and defines the Social Login flow to generate Javascript events to handle the login responses, without redirects to the callback_url configured in the Social Login dashboard:

 socialid.login.init(1, {loginType: "event"});

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

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox