jsmestad/socialite
{ "createdAt": "2011-09-14T19:58:54Z", "defaultBranch": "master", "description": "Support (and manage) Authentication with multiple OmniAuth providers in your Rails application", "fullName": "jsmestad/socialite", "homepage": "https://github.com/jsmestad/socialite", "language": "Ruby", "name": "socialite", "pushedAt": "2013-10-30T18:31:06Z", "stargazersCount": 58, "topics": [ "authentication", "engine", "oauth2", "omniauth", "rails" ], "updatedAt": "2024-01-27T00:58:07Z", "url": "https://github.com/jsmestad/socialite"}up (optional)
Socialite.setup({ /* settings */ });setup allows you to specify settings for each network such as localisation (see below for all options).
Settings
Section titled “Settings”Socialite.setup({ facebook: { lang : 'en_GB', appId : 123456789, onlike : function(url) { /* ... */ }, onunlike : function(url) { /* ... */ }, onsend : function(url) { /* ... */ } }});See Facebook’s documentation on Internationalization for supported language codes.
Socialite.setup({ twitter: { lang : 'en', onclick : function(e) { /* ... */ }, ontweet : function(e) { /* ... */ }, onretweet : function(e) { /* ... */ }, onfavorite : function(e) { /* ... */ }, onfollow : function(e) { /* ... */ } }});See Twitter’s documentation for support on Web Intents Javascript Events and supported Languages.
Twitter share buttons can override the global language setting with a data-lang attribute.
Google+
Section titled “Google+”Socialite.setup({ googleplus: { lang : 'en-GB', onstartinteraction : function(el, e) { /* ... */ }, onendinteraction : function(el, e) { /* ... */ }, callback : function(el, e) { /* ... */ } }});See Google’s documentation for support on Events and Languages.
Contribute
Section titled “Contribute”Send me feedback and testing issues!
The main core of Socialite is built for extensibility. It’s basically a fancy script loader designed for social widgets. They can be stripped out easily if not used and new ones added:
Socialite.network('network', params);Socialite.widget('network', 'widget', params);With these two functions you can add extended support. See the source code for examples (more guides to come here). I’m always working on support and settings for more networks, check back frequently!
WordPress Plugin
Section titled “WordPress Plugin”Tom Morton @tmort has also created a WordPress plugin that packages WPSocialite and makes it a one step installation into your WordPress powered website. Download it from here: http://wordpress.org/plugins/wpsocialite/.
Change Log
Section titled “Change Log”2.0.3 - 11th June 2012
Section titled “2.0.3 - 11th June 2012”- added GitHub Buttons extension
- Google+
window.gapi.render()now used on inner gplus div to avoid inline styles on thesocialiteelement
2.0.2 - 10th June 2012
Section titled “2.0.2 - 10th June 2012”- Hacker News share widget added by @igrigorik
2.0.1 - 9th June 2012
Section titled “2.0.1 - 9th June 2012”- added Google+
googleplus-badgewidget - added a Buffer App extension
- created an
extensionsfolder in the repository - Pinterest and Spotify removed from the default
socialite.jsandsocialite.min.jsbuilds.
Socialite 
Section titled “Socialite ”This is an opinionated Rails 3.1 mountable engine provides your application with support for managing multiple OAuth providers per User.
Why make this?
Section titled “Why make this?”Every site I have built in the past couple years has required implementing
authentication support for Users. Now this was simple enough when it was only
one provider (in my case, “Login with Facebook”), but more often then not
it evolved into “Login with <insert_oauth_provider>”.
Now OmniAuth has some good write-ups on handling multiple providers, but it lacked any support for restricting a user to one identity per provider. Socialite aims to solve this and while enforcing every user to have a Basic Authentication identity as a fall-back in case of password recovery.
What makes this unique?
Section titled “What makes this unique?”- Every User can only have one identity per supported provider
- Example: User can have only 1 linked Facebook Identity at any given time
- Every User must have an basic-auth identity
- Example: User signs up through Facebook, but unlinks it. Enforcing a local basic auth mechanism aids account recovery.
- Supports any provider strategy in the OmniAuth project.
Resources
Section titled “Resources”Installation
Section titled “Installation”To use Socialite in a Rails 3.1 application:
- Require it in the Gemfile:
gem 'socialite', git: 'git://github.com/jsmestad/socialite - Install the gem it by running
bundle install. - Run the socialite generator using
rails g socialite:installfor typical installs andrails g active_record:socialitefor specifying custom options.
History
Section titled “History”This project began as a fork of Tim Riley’s great Omnisocial plugin. The motivation for this fork is that I required multiple authorizations for each account (linking support) and wanted a proper mountable Rails 3.1 Engine.
Copyright & License
Section titled “Copyright & License”Socialite is Copyright (c) 2011- 2013 Justin Smestad. All Rights are Reserved. Code is distributed under the Apache 2.0 License. See LICENSE file for more information.
The original OmniSocial code is Copyright (c) 2010-2011 Tim Riley and Icelab, and is released under MIT License.