Direct Connect \ Social Link
With Social Link your users can link their existing accounts to one or more social networks and then use the Social Login service to login to your website. Social Link can be embedded either by using JavaScript or by using Direct Connect which works without any JavaScript or iFrames.
1. Trigger the social network authentication
To link/unlink a social network the user has to login with that social network account first. To start the authentication simply send the user to the Direct Connect URL. You could for example place that URL on a hyperlink so that users trigger the social network authentication when they click on the link.
Direct Connect URL
Placeholders
Make sure to replace the indicated placeholders by your own values.
Placeholder | Description |
---|---|
* #site-subdomain# |
The subdomain of your OneAll site. Example: myshop |
* #provider-key# |
The key of the social network to link/unlink. Example: twitter, facebook, linkedin, vimeo [...] |
Required URL Parameters
Make sure to always specify the following URL parameters.
URL Parameter | Description |
---|---|
* service |
The service to be used, in this case social_link Example: &service=social_link |
* callback_uri |
The url encoded link to the callback script on your own server. Example: &callback_uri=https%3A%2F%2Fyour-website.com%2Fcallback.php |
* action |
Defines the action to perform. Specify link_identity to link the given social network account.Specify unlink_identity to unlink the given social network account.Example: &action=link_identity |
Optional URL Parameters
Optionally add the following URL parameters.
Optional URL Parameter | Description |
---|---|
scope |
Defines the permission scope to request from the social network. Default: Compiled from the options that you have ticked in your OneAll account. Example: &scope=user_birthday,user_hometown |
force_reauth |
Set to false to do not ask the user to re-enter his social network credentials.Default: true Example: &force_reauth=true |
login_data |
Sets the login data to be used, eg. the OpenID URL. Default: none Example: &login_data=http%3A%2F%2Fmy.server.name%2Fopenidserver%2F |
user_token |
The user_token of the user that links/unlinks the social network account.If you already have a user_token for the user, then it must be specified, otherwise leave it emtpy Example: &user_token=44dd647d-0ce1-448e-9009-9f7d68973637 |
The user_token
is a unique identifier that you receive from the OneAll API whenever a user
connects with Social Login or links an account using Social Link.
If the user has never used Social Login or Social Link then you might not have a user_token
for that user yet.
In this case just leave the user_token
empty to have our API create a new token.
At the first use of Social Login or Social Link you must store the user_token
for that user in your database and specify it in any subsequent uses
of Social Link by the same user.
2. Retrieve and use the social network profile data
After the authentication the user is redirected to the specified callback_uri
to which the OneAll API adds the GET
parameter connection_token
.
Your callback_uri
can fetch the status of the operation by sending a request with that token to the Read Connection Details
resource of the OneAll API.