Socialid.events.onLoginSuccess

From Social ID Developers
(Difference between revisions)
Jump to: navigation, search
(Example)
(Description)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Description ==
 
== Description ==
  
Executado quando o usuário finaliza o processo de login com sucesso.
+
Triggered when the user ends the login process successfully.  
 +
 
 +
This event can also store the returned Connection ID, see [[socialid.connectionStorage]]
  
 
== Adding Handler ==
 
== Adding Handler ==
Line 14: Line 16:
 
|+
 
|+
 
! align="left" width="200px" | token
 
! align="left" width="200px" | token
| Token do usuário que acabou de fazer o login. Com este token e o secret da aplicação de Social Login é possível obter informações do usuário, como seu perfil, por exemplo. É recomendável obter esta informação usando um script server-side (chamado por Ajax) para não expor o secret do Social Login.
+
| Token related to the user that just logged in. With this token and the secret from your Social Login application it's possible to get information about the user (e.g. his profile). It's advisable to get this information using a server-side script so you don't expose your application secret.
 +
|+
 +
! align="left" width="200px" | connection_id
 +
| User active connection id.
 
|+
 
|+
 
! align="left" width="200px" | callback_url
 
! align="left" width="200px" | callback_url
| A url de callback configurada na aplicação de Social Login.
+
| Callback URL configured on the social login application.
 
|+
 
|+
 
! align="left" width="200px" | provider
 
! align="left" width="200px" | provider
| O provider utilizado pelo usuário no login. Pode ser "facebook", "twitter" ou "linkedin".
+
| Provider used in the login process. Can be "facebook", "twitter", "linkedin", or "gplus".
 
|}
 
|}
  
 
== Example ==
 
== Example ==
  
Adicionando um handler para o evento onLoginSuccess do Social Login:
+
Adding a handler for the onLoginSuccess event on Social Login:
  
 
   socialid.events.onLoginSuccess.addHandler(function(data) {
 
   socialid.events.onLoginSuccess.addHandler(function(data) {
Line 31: Line 36:
 
   });
 
   });
  
Exemplo de resposta do objeto data:
+
Example response object:
  
 
   {
 
   {
 
     event: "onLoginSuccess",
 
     event: "onLoginSuccess",
 
     token: "13d7555531d285adc34e21e7a9c583967c7a85507deee61fb6f1eeffc656409w",
 
     token: "13d7555531d285adc34e21e7a9c583967c7a85507deee61fb6f1eeffc656409w",
 +
    connection_id: "1234567890",
 
     callback_url: "https://sid-examples.herokuapp.com/social_logins",
 
     callback_url: "https://sid-examples.herokuapp.com/social_logins",
 
     provider: "facebook"
 
     provider: "facebook"
 
   }
 
   }

Latest revision as of 19:44, 11 November 2020

Contents

Description

Triggered when the user ends the login process successfully.

This event can also store the returned Connection ID, see socialid.connectionStorage

Adding Handler

socialid.events.onLoginSuccess.addHandler(handler)

Event Data

event onLoginSuccess
token Token related to the user that just logged in. With this token and the secret from your Social Login application it's possible to get information about the user (e.g. his profile). It's advisable to get this information using a server-side script so you don't expose your application secret.
connection_id User active connection id.
callback_url Callback URL configured on the social login application.
provider Provider used in the login process. Can be "facebook", "twitter", "linkedin", or "gplus".

Example

Adding a handler for the onLoginSuccess event on Social Login:

 socialid.events.onLoginSuccess.addHandler(function(data) {
   console.log("Website received onLoginSuccess: ", data);
 });

Example response object:

 {
   event: "onLoginSuccess",
   token: "13d7555531d285adc34e21e7a9c583967c7a85507deee61fb6f1eeffc656409w",
   connection_id: "1234567890",
   callback_url: "https://sid-examples.herokuapp.com/social_logins",
   provider: "facebook"
 }
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox