Socialid.login.init

(Difference between revisions)
Jump to: navigation, search
(Example)
(Parameters)
Line 26: Line 26:
 
! align="left" width="200px" style="padding-left: 20px" | loginType
 
! align="left" width="200px" style="padding-left: 20px" | loginType
 
| width="200px" | optional
 
| width="200px" | optional
| Define how the Social Login will be performed in the browser (see the description above). It could be "callback", "event" or "redirect". Default: "event".
+
| Define how the Social Login will be performed in the browser (see the description above). Can be "callback", "event" or "redirect". Default: "event".
 
|}
 
|}
  

Revision as of 13:07, 4 November 2014

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.

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".

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