Socialid.login.moveTo

(Difference between revisions)
Jump to: navigation, search
(Description)
Line 1: Line 1:
 
== Description ==
 
== Description ==
  
Chama a API para mover os dados do usuário atualmente logado para um outro usuário identificado por "userId" e "userToken" e remove o usuário que estava logado. O outro usuário de "userId" herdará a conexão anterior e ficará logado.
+
API to move data from the user logged in the current login session to another user identified by "userId" and "userToken" and then removes the user that was logged in. The another user "userId" will inherit the previous connection, that is, this user will be logged in the current login session.
  
O "userId" e "userToken" podem ser obtidos a partir da API [[GET login/info]] ou [[GET login/users/:user_id]].
+
The "userId" and "userToken" can be retrieved from [[GET login/info]] or [[GET login/users/:user_id]] APIs.
  
Esta API é útil para juntar usuários quando se sabe que são a mesma pessoa.
+
A common use case for this API is to merge users when you known they are the same person.
  
<span style="color: red">Importante:</span> veja a página de [[Social Login Tokens|tokens do Social Login]] para maiores informações sobre os tokens usados no Social Login e boas práticas de segurança.
+
<span style="color: red">Important:</span> see [[Social Login Tokens]] for detailed information about the tokens used by the Social Login and best security practices.
  
 
== Usage ==
 
== Usage ==
Line 17: Line 17:
 
{|
 
{|
 
! align="left" width="200px" | userId
 
! align="left" width="200px" | userId
| width="200px" | obrigatório
+
| width="200px" | required
| Id do usuário de destino, para o qual se deseja mover os dados do usuário atualmente logado.
+
| Identifier of the target user, for which you want to move the data from the user currently logged.
 
|+
 
|+
 
! align="left" width="200px" | userToken
 
! align="left" width="200px" | userToken
| width="200px" | obrigatório
+
| width="200px" | required
| Token do usuário de destino.
+
| Token of the target user.
 
|+
 
|+
 
! 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 33: Line 33:
 
{|
 
{|
 
! align="left" width="200px" | data
 
! align="left" width="200px" | data
| Sempre "null". Esta API não retorna dados.
+
| Always "null". This API does not return data.
 
|+
 
|+
 
! align="left" width="200px" | status
 
! align="left" width="200px" | status
| O status da execução da chamada da API. Pode ser "success", se o usuário foi movido com sucesso, "not_found", caso não exista um usuário logado no momento, ou "forbidden" caso não se tenha permissão para executar a operação.
+
| The API response status. Can be success, if the user has been moved successfully, "not_found", if there is no user currently logged, or "forbidden" if the provided credentials are not allowed to perform this operation.
 
|}
 
|}
  

Revision as of 12:10, 4 November 2014

Contents

Description

API to move data from the user logged in the current login session to another user identified by "userId" and "userToken" and then removes the user that was logged in. The another user "userId" will inherit the previous connection, that is, this user will be logged in the current login session.

The "userId" and "userToken" can be retrieved from GET login/info or GET login/users/:user_id APIs.

A common use case for this API is to merge users when you known they are the same person.

Important: see Social Login Tokens for detailed information about the tokens used by the Social Login and best security practices.

Usage

 socialid.login.moveTo(userId, userToken, handler)

Parameters

userId required Identifier of the target user, for which you want to move the data from the user currently logged.
userToken required Token of the target user.
handler optional Callback function to handle the API response.

API Response

data Always "null". This API does not return data.
status The API response status. Can be success, if the user has been moved successfully, "not_found", if there is no user currently logged, or "forbidden" if the provided credentials are not allowed to perform this operation.

Example

Move o usuário da sessão atual para um outro usuário identificado por userId e userToken:

 var handler = function(response) {
    if (response.status == "success") {
       alert("Usuário movido com sucesso");
    } else if (response.status == "not_found") {
       alert("Não há usuário logado no momento.");
    } else {
       alert("User_id e user_token não conferem.");
    }
 }
 var appId = 1, userId = 34, userToken = '1234567890';
 socialid.login.init(appId);
 socialid.login.moveTo(userId, userToken, handler);

Teste as APIs em nosso playground: https://sid-examples.herokuapp.com/social_logins/playground

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox