Socialid.login.startLogin
(Difference between revisions)
(→Parameters) |
(→Description) |
||
Line 2: | Line 2: | ||
Starts the social login process for the given provider. Can open a popup dialog or redirect to the provider, depending on the [[socialid.login.init|loginType]]. | Starts the social login process for the given provider. Can open a popup dialog or redirect to the provider, depending on the [[socialid.login.init|loginType]]. | ||
+ | |||
+ | ==== Event Login Type ==== | ||
When the [[socialid.login.init|loginType]] is set to ''"event"'', this method can trigger the following events: | When the [[socialid.login.init|loginType]] is set to ''"event"'', this method can trigger the following events: | ||
Line 8: | Line 10: | ||
* [[socialid.events.onLoginCancel]] | * [[socialid.events.onLoginCancel]] | ||
* [[socialid.events.onLoginError]] | * [[socialid.events.onLoginError]] | ||
+ | |||
+ | ==== Redirect Login Type ==== | ||
+ | |||
+ | When the [[socialid.login.init|loginType]] is set to "redirect", the user is redirected via HTTP POST to the redirect URI after the login succeeds. The [[Social Login Tokens|login_token]] is passed along as the '''token''' POST parameter. | ||
== Usage == | == Usage == |
Revision as of 15:50, 23 November 2017
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:
- socialid.events.onLoginStart
- socialid.events.onLoginSuccess
- socialid.events.onLoginCancel
- socialid.events.onLoginError
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.
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 |
---|
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