Giter Site home page Giter Site logo

jtapia / solidus_social Goto Github PK

View Code? Open in Web Editor NEW

This project forked from solidusio-contrib/solidus_social

0.0 2.0 0.0 459 KB

:+1: Building block for social networking features (provides authentication and account linkage)

License: BSD 3-Clause "New" or "Revised" License

Ruby 81.49% JavaScript 0.13% CSS 0.21% HTML 18.18%

solidus_social's Introduction

Solidus Social

Build Status Code Climate

Social login support for Solidus. Solidus Social handles authorization, account creation and association through third-party services. Currently Twitter, Facebook, Github, Google OAuth2, and Amazon are available out of the box.

Installation

Add this extension to your Gemfile:

gem 'solidus_social'

Then run:

$ bundle && bundle exec rails g solidus_social:install
$ bundle exec rake db:migrate

This will install a new initializer config/initializers/solidus_social.rb into your project that allows you to setup the services you want configured for your app.

Optional: By default the login path will be '/users/auth/:provider'. If you want something else, configure it in config/initializers/solidus_social.rb.

Using OAuth Sources

Login as an admin user and navigate to Configuration > Social Authentication Methods

Click "New Authentication Method" and choose one of your configured providers.

You MUST restart your application after configuring or updating an authentication method.

Registering Your Application

Facebook, Twitter, Github, Google OAuth2, and Amazon are supported out of the box but, you will need to register your application with each of the sites you want to use.

When setting up development applications, keep in mind that most services do not support localhost for your URL/domain. You will need to us a regular domain (i.e. domain.tld, hostname.local) or an IP addresses (127.0.0.1). Make sure you specifity the right IP address.

Facebook

Facebook / Developers / Apps

  1. Name the app and agree to the terms.
  2. Fill out the capcha.
  3. Under the "Web Site" tab enter:
  • Site URL: http://yourhostname.local:3000 for development and http://your-site.com for production
  • Site domain: yourhostname.local and your-site.com respectively

Twitter

Twitter / Application Management / Create an application

  1. Fill in the name and description.
  2. Fill in the rest of the details:
  • Application Website: http://yourhostname.local:3000 for development and http://your-site.com for production
  • Application Type: "Browser"
  • Callback URL: http://yourhostname.local:3000 for development and http://your-site.com for production
  • Default Access Type: "Read & Write"
  1. Save the application.

Github

Github / Applications / Register a new OAuth application

  1. Name the application.
  2. Fill in the details
  • Main URL: http://yourhostname.local:3000 for development and http://your-site.com for production
  • Callback URL: http://yourhostname.local:3000 for development and http://your-site.com for production
  1. Click Create.

Amazon

Amazon / App Console / Register a new OAuth application

  1. Register New Application.
  2. Name the Application, provide description and URL for Privacy Policy.
  3. Click Save.
  4. Add Your site under Web Settings > Allowed Return URLs (example: http://localhost:3000/users/auth/amazon/callback)

The app console is available at https://login.amazon.com/manageApps

Google OAuth2

Google / APIs / Credentials/ Create Credential

  1. In the APIs and Services dashboard, visit 'Credentials' on the side, then select 'Create Credentials' and 'Oauth client ID'.
  2. Name the Application, select "Web Application" as a type.
  3. Under "Authorized redirect URIs", add your site (example: http://localhost:3000/users/auth/google_oauth2/callback)

More info: https://developers.google.com/identity/protocols/OAuth2

Other OAuth Providers

Other OAuth providers are supported, given that there is an OmniAuth strategy for them. (If there isn't, you can write one.)

LinkedIn Example

  1. Add gem "omniauth-linkedin" to your Gemfile and run bundle install.

  2. In config/initializers/solidus_social.rb add and initialize a new provider for SolidusSocial:

      config.providers = {
        # The configuration key has to match your omniauth strategy.
        linkedin: {
          api_key: ENV['LINKEDIN_API_KEY'],
          api_secret: ENV['LINKEDIN_API_SECRET'],
        },
        # More providers here
  3. Activate your provider as usual.

  4. Do one of the following:

    • Override the spree/users/social view to render OAuth links to display your LinkedIn link.
    • Include in your CSS a definition for .icon-spree-linkedin-circled and an embedded icon font for LinkedIn from Fontello (the way existing icons for Facebook, Twitter, etc are implemented). You can also override CSS classes for other providers, .icon-spree-<provider>-circled, to use different font icons or classic background images, without having to override views.

Documentation

API documentation is available on RubyDoc.info.

Contributing

See corresponding guidelines.

Copyright (c) 2014 John Dyer and contributors, released under the New BSD License

solidus_social's People

Contributors

lbrapid avatar jhawthorn avatar radar avatar futhr avatar jarednorman avatar mamhoff avatar jdutil avatar sbounmy avatar braidn avatar geekoncoffee avatar jackkinsella avatar bosskovic avatar wuboy0307 avatar jschwertfeger avatar swrobel avatar ph1ll avatar parndt avatar pmn4 avatar dpritchett avatar cbrunsdon avatar ccarruitero avatar mattdunbar avatar uranazo avatar ramprasadg avatar mrpollo avatar traels avatar suryart avatar vladimir-shidlovsky avatar westonganger avatar alexandremcosta avatar

Watchers

James Cloos avatar Jonathan Tapia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.