Social Login User Guide

From Social ID Developers
(Difference between revisions)
Jump to: navigation, search
 
(29 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Introdução ==
+
== Introduction ==
  
Social Login permite que usuários se loguem em websites ou aplicações usando suas contas do Facebook, Twitter, LinkedIn ou outras redes. Isso aumenta o engajamento e taxas de conversão pois oferece um simples processo de cadastro, uma vez que o usuário começa a interagir com o website com apenas 1 clique ao invés de preencher complexos formulários de cadastro. A maioria dos usuários já estão acostumados com suas redes sociais no dia-a-dia e preferem usar logins sociais no lugar do tradicional login com usuário e senha.
+
Social Login allows users to log into websites or applications using their Facebook, Twitter, LinkedIn, Google or Instagram accounts. This increases engagement and conversion rates by offering a simple registration mechanism where users can start interacting with the website with just 1 click instead of forcing the user to fill out multiple fields on a registration form. Most people use their social network accounts on a daily basis and would rather log in using these accounts than use a traditional email / password login.
  
[[File:Social login diagram.png]]
+
[[File:Social login diagram.png|400px]]
  
A implementação do Social Login consiste em 3 etapas:
+
Social Login implementation is divided into 3 steps:
  
# Configurar uma instância do Social Login
+
# Configure a Social Login instance
# Instalar o widget no Website
+
# Install the widget on the website
# Implementar o callback no Website
+
# Implement the callback on the website
  
== Configuração do Social Login ==
+
== Social Login Configuration ==
  
A imagem acima mostra a tela de configuração do Social Login. Nesta tela deve-se configurar:
+
[[File:Social login settings.png|500px]]
  
* Nome: um nome para a instância do Social Login usado apenas como referência interna.
+
The picture above shows the Social Login configuration screen. On this screen you have to fill out:
* Callback url: a url para a qual iremos postar o token de identificação do usuário que acabou de realizar login social no website.
+
* Métodos de inscrição: as redes sociais disponíveis para o usuário realizar login social. É possível customizar as aplicações sociais para serem usadas aqui. Estas aplicações sociais podem ser configuradas nas próprias redes sociais para levar em consideração o branding da marca, como o nome e logo:
+
  
A criação de aplicações sociais é realizada seguindo os passos de um wizard de configuração:
+
* Name: a name for the Social Login instance (used as an internal reference only).
 +
* Callback URL: the URL that will receive a post request with the user identification token after a successful login attempt.
 +
* Registration methods: social networks that can be used to perform the Social Login. It is possible to change the social applications used here; these social applications can be configured on the social networks themselves to take branding like name and logo into consideration:
  
== Instalação do Widget ==
+
[[File:Social id facebook app.png|500px]]
  
A instalação do widget no website é realizada a partir da aplicação de um trecho de código em Javascript que carrega o widget no local configurado para ele aparecer. A tela que permite configurar o tema do widget e que fornece o trecho de código Javascript pode ser vista na seguinte imagem:
+
The creation of social applications is done by following a configuration wizard:
  
Ao se entrar na página configurada com o código Javascript, o seguinte widget deve ser visualizado, se configurado com o tema “bricks”:
+
[[File:Social app id secret.png|500px]]
  
Ou se configurado com o tema “icons”:
+
== Widget Installation ==
  
== Implementação do Callback ==
+
This installation is done by pasting a Javascript code snippet that loads the Social Login widget into place. The screen that allows configuring the widget theme and shows the Javascript code snippet is shown in the following picture:
  
Nesta etapa é implementada a integração do social login com o gerenciamento de usuários já existente no website. Fornecemos APIs que permitem esta integração de uma forma bastante simples. A idéia basicamente é relacionar o “id” do usuário no social login com o “id” do usuário no website. Dois casos podem acontecer:
+
[[File:Social login widget code.png|300px]]
  
1. No callback, o “id” do usuário no social login não está relacionado com nenhum usuário do website: neste caso, este é um login social novo, então deve-se criar um usuário no website e relacioná-lo com o usuário do social login, ou, caso já exista um usuário logado no website (via login tradicional, por exemplo), basta relacioná-lo com o usuário do social login.
+
When entering a page configured with the Javascript code, the following widget should be seen (if configured with the "bricks" theme):
  
2. No callback, o “id” do usuário no social login já está relacionado a um usuário do website: neste caso basta logar o usuário na sessão do website.
+
[[File:Social login widget bricks.png|200px]]
  
Para se obter o “id” do usuário no social login na url de callback basta seguir os passos explicados na tela de “Chamar a API” do produto:
+
Or if you use the "icons" theme:
  
=== Passo 1: Extraia o parâmetro token dos dados do POST ===
+
[[File:Social login widget icons.png|150px]]
  
Enviamos nos dados POST um parâmetro “token” que identifica o usuário que acabou de ser registrado na aplicação de Social Login implantada em seu site. Você precisa usar esse token para chamar nossa API e obter a informação de autenticação do usuário.
+
== Callback Implementation ==
  
=== Passo 2: Chame nossa API para obter informações de autenticação do usuário ===
+
This step is used to integrate the social login with the user management system that is already on the website. We have APIs that allow this integration in a very simple way. The basic idea is to associate the user's "id" on the social login and the user's "id" on your website. Two things can happen:
  
Use o token que você acabou de receber e sua API secret para chamar a API login/info. Retornaremos um JSON com as informações básicas do usuário e da autenticação usada por ele.
+
1. On the callback, the user's "id" is not related with any website user: in this case, a new user should be created (on the website) and associated with the social login user. If a user already exists, (say if the user created a traditional account), the user's account should be associated with the social login account.
  
URL da API para chamar:
+
2. On the callback, the user's "id" is already associated with a website user: in this case, the user should be logged in.
  
  GET https://api.socialidnow.com/v1/marketing/login/info?api_secret=<secret>&token=<token>
+
To get the user's "id" from the Social Login, follow the steps explained on the "Call the API" screen:
  
Parâmetros:
+
[[File:Social login call api.png|500px]]
* api_secret: o secret fornecido na tela de “Chamar a API”
+
* token: o token fornecido no passo 1
+
  
=== Passo 3: Extrair o id do usuário a partir da resposta do login/info ===
+
=== Step 1: Extract the "token" parameter from POST data ===
  
Quando você chamar a API login/info você receberá uma resposta assim:
+
We send a parameter via POST called "token" that identifies the user that just registered/logged into the Social Login used on your website. Use this token to call the API and get the user's authentication information.
  
Você pode usar o campo "id" como a chave única para identificar o usuário em seu site. Este é o “id” do usuário no social login.
+
=== Step 2: Call our API to get the user's authentication information ===
  
== Sessão do usuário no Social Login ==
+
Use the token you just received and your API secret to call the login/info API. You will receive a JSON data structure with basic information about the user and the authentication method used by him/her.
  
A API login/info fornece um dado importante: “connection_id”.
+
URL to call:
  
Mantemos uma identificação da sessão de cada usuário logado no Social Login para usar em certas APIs e widgets, de forma a manter seguro o acesso a estes recursos. Por enquanto, temos disponíveis os seguintes recursos que dependem do “connection_id”:
+
  GET [https://api.socialidnow.com/v1/marketing/login/info?api_secret=secret&token=token https://api.socialidnow.com/v1/marketing/login/info?api_secret=<secret>&token=<token>]
  
* Connect Widget: permite que usuários relacionem mais de uma rede social a sua conta, permitindo logar no website usando múltiplas redes sociais. Ao integrar o código Javascript deste widget, é necessário passar como parâmetro o “connection_id” do usuário logado no momento.
+
Parameters:
* Webform: é possível configurar um webform relacionado a uma instância do social login, mostrando um formulário no contexto do usuário logado no social login. Ao integrar o código Javascript do webform, é necessário passar como parâmetro o “connection_id” do usuário logado no momento.
+
* api_secret: you can get the "secret" on the "Call the API" screen
* API de Logout: invalida um “connection_id” de um usuário no social login, desta forma não poderá ser usado pelos widgets ou APIs que dependam deste id. Uma boa prática é chamar esta API toda vez que um usuário se desloga do website.
+
* token: the token returned in step 1
  
É importante salientar que este “connection_id” muda a cada login social do usuário, portanto, só deve ser usado no contexto de uma sessão de login.
+
=== Step 3: Extract the user's "id" from the login/info response ===
 +
 
 +
When you call the login/info API you'll get a response like this:
 +
 
 +
[[File:Api login info.png|500px]]
 +
 
 +
You can use the "id" field as a unique key to identify the user on your website. This is this user's "id" on the Social Login.
 +
 
 +
== Social Login user session ==
 +
 
 +
The login/info API returns another very important value: “connection_id”. We keep a session identification for every logged in user on the Social Login to use in certain APIs and widgets (to simplify the use of these resources).
 +
 
 +
The moment the user logs into the Social Login, we store a session cookie on his/her browser and track the "connection_id" so that we can identify the user automatically on certain widgets and APIs. Some RESTful APIs require the "connection_id" value, and so it is returned by the login/info API.
 +
 
 +
It is important to note that this "connection_id" value changes every time the user logs in, so it should only be used as a *session* identification method.

Latest revision as of 15:01, 9 May 2019

Contents

Introduction

Social Login allows users to log into websites or applications using their Facebook, Twitter, LinkedIn, Google or Instagram accounts. This increases engagement and conversion rates by offering a simple registration mechanism where users can start interacting with the website with just 1 click instead of forcing the user to fill out multiple fields on a registration form. Most people use their social network accounts on a daily basis and would rather log in using these accounts than use a traditional email / password login.

Social login diagram.png

Social Login implementation is divided into 3 steps:

  1. Configure a Social Login instance
  2. Install the widget on the website
  3. Implement the callback on the website

Social Login Configuration

Social login settings.png

The picture above shows the Social Login configuration screen. On this screen you have to fill out:

  • Name: a name for the Social Login instance (used as an internal reference only).
  • Callback URL: the URL that will receive a post request with the user identification token after a successful login attempt.
  • Registration methods: social networks that can be used to perform the Social Login. It is possible to change the social applications used here; these social applications can be configured on the social networks themselves to take branding like name and logo into consideration:

Social id facebook app.png

The creation of social applications is done by following a configuration wizard:

Social app id secret.png

Widget Installation

This installation is done by pasting a Javascript code snippet that loads the Social Login widget into place. The screen that allows configuring the widget theme and shows the Javascript code snippet is shown in the following picture:

Social login widget code.png

When entering a page configured with the Javascript code, the following widget should be seen (if configured with the "bricks" theme):

Social login widget bricks.png

Or if you use the "icons" theme:

Social login widget icons.png

Callback Implementation

This step is used to integrate the social login with the user management system that is already on the website. We have APIs that allow this integration in a very simple way. The basic idea is to associate the user's "id" on the social login and the user's "id" on your website. Two things can happen:

1. On the callback, the user's "id" is not related with any website user: in this case, a new user should be created (on the website) and associated with the social login user. If a user already exists, (say if the user created a traditional account), the user's account should be associated with the social login account.

2. On the callback, the user's "id" is already associated with a website user: in this case, the user should be logged in.

To get the user's "id" from the Social Login, follow the steps explained on the "Call the API" screen:

Social login call api.png

Step 1: Extract the "token" parameter from POST data

We send a parameter via POST called "token" that identifies the user that just registered/logged into the Social Login used on your website. Use this token to call the API and get the user's authentication information.

Step 2: Call our API to get the user's authentication information

Use the token you just received and your API secret to call the login/info API. You will receive a JSON data structure with basic information about the user and the authentication method used by him/her.

URL to call:

  GET https://api.socialidnow.com/v1/marketing/login/info?api_secret=<secret>&token=<token>

Parameters:

  • api_secret: you can get the "secret" on the "Call the API" screen
  • token: the token returned in step 1

Step 3: Extract the user's "id" from the login/info response

When you call the login/info API you'll get a response like this:

Api login info.png

You can use the "id" field as a unique key to identify the user on your website. This is this user's "id" on the Social Login.

Social Login user session

The login/info API returns another very important value: “connection_id”. We keep a session identification for every logged in user on the Social Login to use in certain APIs and widgets (to simplify the use of these resources).

The moment the user logs into the Social Login, we store a session cookie on his/her browser and track the "connection_id" so that we can identify the user automatically on certain widgets and APIs. Some RESTful APIs require the "connection_id" value, and so it is returned by the login/info API.

It is important to note that this "connection_id" value changes every time the user logs in, so it should only be used as a *session* identification method.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox