Socialid.login.moveTo

(Difference between revisions)
Jump to: navigation, search
(API Response)
Line 36: Line 36:
 
|+
 
|+
 
! align="left" width="200px" | status
 
! align="left" width="200px" | 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.
+
| 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:11, 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