JavaScript API Methods \ Social Link

The following methods can be used with our Social Link service. Social Link allows your users to link one or more social networks to their existing account on your website. The linked social network accounts can then also be used to login using our Social Login service. The Social Link implementation guide is available here.

Social Link Methods

set_providers

Sets the social networks to be displayed in the Social Link widget.

Default: no value

	/* 
	Signature 
		<providers> : array object 
	*/
	_oneall.push(['social_link', 'set_providers', <providers>]);


	/* Example */
	_oneall.push(['social_link', 'set_providers', ['facebook', 'twitter']]);

set_grid_size

Sets the maximum number of social networks that should be displayed vertically or horizontally before the pagination of the icons takes place.

Default: no limitation

	/* 
	Signature 
		<axis> : character (x, y)
		<number> : integer
	*/
	_oneall.push(['social_link', 'set_grid_size', <axis>, <number>]);


	/* Example */
	_oneall.push(['social_link', 'set_grid_size', 'x', 2]);
	_oneall.push(['social_link', 'set_grid_size', 'y', 4]);

set_grid_sizes

Sets the maximum number of social networks that should be displayed vertically and horizontally in one call.

Default: no limitation

	/* 
	Signature 
		<x-axis> : integer
		<y-axis> : integer
	*/
	_oneall.push(['social_link', 'set_grid_sizes', [<x-axis>, <y-axis>]]);


	/* Example */
	_oneall.push(['social_link', 'set_grid_sizes', [2, 4]]);

set_force_re_authentication

Forces the user to re-authenticate when linking a social network account. If set to true, the social network will ask the user to re-enter his credentials. Not all providers support this feature.

Default: false

	/* 
	Signature 
		<force-re-authentication> : boolean (true, false)
	*/
	_oneall.push(['social_link', 'set_force_re_authentication', <force-re-authentication>]);


	/* Example: Do not force re-authentication */
	_oneall.push(['social_link', 'set_force_re_authentication', false]);

	/* Example: Always force re-authentication */
	_oneall.push(['social_link', 'set_force_re_authentication', true]);

set_provider_scope

Advanced API Feature

Sets the permissions/scope to be requested from the user when he logs in with his social network account. The specified scope is forwarded as specified to the social network; please take care to use the format expected by the social network.

Default: set automatically based on the social network settings in your OneAll account

	/* 
	Signature 
		<provider> : string (the name key of the provider)
		<provider_scope> : string (the permissions/scope to request from the user)
	*/
	_oneall.push(['social_link', 'set_provider_scope', <provider>, <provider_scope>]);

	/* Example */
	_oneall.push(['social_link', 'set_provider_scope', 'facebook', 'user_website,user_work_history']);

set_popup_usage

This flag controls whether the social network authentication is displayed in a popup or in the same browser window. The default value autodetect enables popups on desktop computers and disables popups on mobile devices.

Default: autodetect

	/* 
	Signature 
		<popup_usage> : string (autodetect, always, never)
	*/
	_oneall.push(['social_link', 'set_popup_usage', <popup_usage>]);


	/* Example: Always use popups except on mobile devices */
	_oneall.push(['social_link', 'set_popup_usage', 'autodetect']);

	/* Example: Always use popups */
	_oneall.push(['social_link', 'set_popup_usage', 'always']);

	/* Example: Never use popups */
	_oneall.push(['social_link', 'set_popup_usage', 'never']);

set_custom_css_uri

Custom CSS Feature

Specifies the URL of a CSS stylesheet to be used in the Social Link widget. By using your own stylesheet you can fully customize the look and feel of the Social Link widget. Example stylesheets can be downloaded in the Customisation Panel of your site in your OneAll account. This method also accepts protocol-relative URLs.

Default: no value

	/* 
	Signature 
		<custom_css_uri> : string (a full URL to a CSS file on your server)
	*/
	_oneall.push(['social_link', 'set_custom_css_uri', <custom_css_uri>]);


	/* Example */
	_oneall.push(['social_link', 'set_custom_css_uri', 'https://secure.oneallcdn.com/css/api/themes/beveled_connect_w208_h30_wc_v1.css']);

	/* Example (Protocol-relative URL) */
	_oneall.push(['social_link', 'set_custom_css_uri', '//oneallcdn.com/css/api/themes/beveled_connect_w208_h30_wc_v1.css']);

set_callback_uri

Sets the callback_uri to redirect the user to after having authenticated with his social network account. Specify a full URL to a file on your server. This method also accepts protocol-relative URLs.

Default: no value

	/* 
	Signature 
		<callback_uri> : string (a full URL to a script on your server)
	*/
	_oneall.push(['social_link', 'set_callback_uri', <callback_uri>]);


	/* Example */
	_oneall.push(['social_link', 'set_callback_uri', 'https://app.oneall.com/social-connect/']);

	/* Example (Protocol-relative URL) */
	_oneall.push(['social_link', 'set_callback_uri', '//app.oneall.com/social-connect/']);

set_event

Advanced API Feature

Defines a custom JavaScript function that is executed whenever an event is triggered. This method will replace any functions that might already have been registered for the given event.

Default: no value

	/* 
	Signature 
		<event> : string (the event that will trigger the function)
		<function> : JavaScript function
	*/
	_oneall.push(['social_link', 'set_event', <event>, <function>]);


	/* Example */
	var my_function = function (){alert("Widget Loaded");}
	_oneall.push(['social_link', 'set_event', 'on_widget_loaded', my_function]);

add_event

Advanced API Feature

With this method you can enqueue multiple JavaScript functions that are exectued successively whenever an event is triggered.

Default: no value

	/* 
	Signature 
		<event> : string (the event that will trigger the function)
		<function> : JavaScript function
	*/
	_oneall.push(['social_link', 'add_event', <event>, <function>]);


	/* Example */
	var my_function_hello = function (){alert("Hello");}
	var my_function_world = function (){alert("World");}
	_oneall.push(['social_link', 'add_event', 'on_widget_loaded', my_function_hello]);
	_oneall.push(['social_link', 'add_event', 'on_widget_loaded', my_function_world]);

attach_onclick_popup_ui

Attaches an onclick event to the DOM container with the given id. A modal dialog with the chosen social networks will be displayed when users clicks on that container. Users can then click on one of the social network icons to start the authentication process.

	/* 
	Signature 
		<dom-container-id> : string (identifier of a DOM element)
	*/
	_oneall.push(['social_link', 'attach_onclick_popup_ui', <dom-container-id>]);


	/* Example */
	_oneall.push(['social_link', 'attach_onclick_popup_ui', 'my_link']);
	/* Example container: <a id="my_link">Click Me</a> */

do_popup_ui

Displays a modal dialog with the chosen social networks. Users can then click on one of the social network icons to start the authentication process.

	/* 
	Signature 
		- This method accepts no arguments
	*/
	_oneall.push(['social_link', 'do_popup_ui']);


	/* Example */
	_oneall.push(['social_link', 'do_popup_ui']);

do_render_ui

Renders the widget and displays the chosen social networks in the DOM container with the specified id. Once the element has been rendered it's no longer possible to call any methods on it.

	/* 
	Signature 
		<dom-container-id> : string (identifier of a DOM element)
	*/
	_oneall.push(['social_link', 'do_render_ui', <dom-container-id>]);


	/* Example */
	_oneall.push(['social_link', 'do_render_ui', 'my_container']);
	/* Example container: <div id="my_container"></div> */

User Contributed Notes