Socialid.login.init
From Social ID Developers
Revision as of 13:53, 31 October 2014 by Renato.neves (Talk | contribs)
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.
- 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 Javascript 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 | obrigatório | o identificador numérico da aplicação do social login | options | opcional | um objeto contendo parâmetros adicionais | loginType | opcional | Pode ser "callback", "event" or "redirect". Default: "event". |
---|
Example
Inicializando a API do Social Login para user usado pela aplicação de id "1" e gerando eventos a serem tratados por Javascript ("event"), sem redirecionar automaticamente para o callback_url cadastrado na aplicação:
socialid.login.init(1, {loginType: "event"});
Teste os parâmetros em nosso playground: https://sid-examples.herokuapp.com/social_logins/playground