Socialid.login.getUserInfo

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
== Description ==
 
== Description ==
  
Chama a API para obter informações básicas do usuário atualmente logado no Social Login.
+
API to get basic information about the user logged in the current login session.
  
 
== Usage ==
 
== Usage ==
Line 11: Line 11:
 
{|
 
{|
 
! align="left" width="200px" | handler
 
! align="left" width="200px" | handler
| width="200px" | opcional
+
| width="200px" | optional
| Especifica uma função de callback para tratar a resposta da API.
+
| Callback function to handle the API response.
 
|}
 
|}
  
Line 19: Line 19:
 
{|
 
{|
 
! align="left" width="200px" | data
 
! align="left" width="200px" | data
| Objeto contendo dados do usuário logado. As propriedades do objeto são: name, email, location, facebook, twitter, linkedin e gplus. As propriedades facebook, twitter, linkedin e gplus só estarão disponíveis para as redes sociais conectadas pelo usuário.
+
| Javascript object containing data from the user logged in. The object properties are: name, email, location, facebook, twitter, linkedin and gplus. The properties facebook, twitter, linkedin and gplus will be available only for the providers connected by the user.
 
|+
 
|+
 
! align="left" width="200px" | status
 
! align="left" width="200px" | status
| O status da execução da chamada da API. Pode ser "success", se existe um usuário logado e os dados foram obtidos com sucesso, ou "not_found", caso não exista um usuário logado na sessão atual.
+
| The API response status. It could be "success", if there is an user logged in the current login session and its data was successfully retrieved, or "not_found", if there is no user logged in the current login session.
 
|}
 
|}
  
 
== Example ==
 
== Example ==
  
Obtém informações do usuário logado na sessão atual:
+
Get basic information about the user logged in the current login session:
  
 
   socialid.login.init(1);
 
   socialid.login.init(1);
 
   var handler = function(response) {
 
   var handler = function(response) {
 
     if (response.status == "success") {
 
     if (response.status == "success") {
         alert("Bem-vindo " + data.name);
+
         alert("Welcome " + data.name);
 
     } else {
 
     } else {
         alert("Não foi possível obter dados do usuário atual.");
+
         alert("Could not get info from the current logged in user.");
 
     }
 
     }
 
   }
 
   }
 
   socialid.login.getUserInfo(handler);
 
   socialid.login.getUserInfo(handler);
  
Exemplo de dados no objeto "data":
+
Example of "data" object:
  
 
   data = {
 
   data = {
Line 63: Line 63:
 
   }
 
   }
  
Teste as APIs em nosso playground: https://sid-examples.herokuapp.com/social_logins/playground
+
You can test this parameters in our playground: https://sid-examples.herokuapp.com/social_logins/playground

Revision as of 18:19, 3 November 2014

Contents

Description

API to get basic information about the user logged in the current login session.

Usage

 socialid.login.getUserInfo(handler)

Parameters

handler optional Callback function to handle the API response.

API Response

data Javascript object containing data from the user logged in. The object properties are: name, email, location, facebook, twitter, linkedin and gplus. The properties facebook, twitter, linkedin and gplus will be available only for the providers connected by the user.
status The API response status. It could be "success", if there is an user logged in the current login session and its data was successfully retrieved, or "not_found", if there is no user logged in the current login session.

Example

Get basic information about the user logged in the current login session:

 socialid.login.init(1);
 var handler = function(response) {
    if (response.status == "success") {
       alert("Welcome " + data.name);
    } else {
       alert("Could not get info from the current logged in user.");
    }
 }
 socialid.login.getUserInfo(handler);

Example of "data" object:

 data = {
   name: "John Doe",
   email: "johndoe@example.com",
   location: "New York",
   facebook: {
      picture_url: "http://www.facebook.com/johndoe.jpg",
      profile_url: "http://www.facebook.com/johndoe"
   },
   twitter: {
      picture_url: "http://www.twitter.com/johndoe.jpg",
      profile_url: "http://www.twitter.com/johndoe"
   },
   linkedin: {
      picture_url: "http://www.linkedin.com/johndoe.jpg",
      profile_url: "http://www.linkedin.com/johndoe"
   },
   gplus: {
      picture_url: "http://plus.google.com/johndoe.jpg",
      profile_url: "http://plus.google.com/johndoe"
   }
 }

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

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox