Giter Site home page Giter Site logo

genba / spree_social Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spree-contrib/spree_social

0.0 1.0 0.0 745 KB

Building block for spree social networking features (provides authentication and account linkage)

Home Page: http://spreecommerce.com

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

spree_social's Introduction

SpreeSocial

Build Status Code Climate

Core for all social media related functionality for Spree. The Spree Social gem handles authorization, account creation and association through social media sources such as Twitter and Facebook. This requires the edge source of Spree. This gem is beta at best and should be treated as such. Features and code base will change rapidly as this is under active development. Use with caution.

Setup for Production

Add this extension to your Gemfile:

gem 'spree_social', github: 'spree/spree_social', branch: 'master'

Then run:

$ bundle update
$ rails g spree_social:install
$ bundle exec rake db:migrate

Preference(optional): By default url will be '/users/auth/:provider'. If you wish to modify the url to: '/member/auth/:provider', '/profile/auth/:provider', or '/auth/:provider' then you can do this accordingly in your config/initializers/spree.rb file as described below -

Spree::SocialConfig[:path_prefix] = 'member' # for /member/auth/:provider
Spree::SocialConfig[:path_prefix] = 'profile' # for /profile/auth/:provider
Spree::SocialConfig[:path_prefix] = '' # for /auth/:provider

Spree Setup to Utilize OAuth Sources

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

Click on the New Authentication Method button to enter the key obtained from their respective source (See below for instructions on setting up the various providers)

Multiple key entries can now be entered based on the rails environment. This allows for portability and the lack of need to check in your key to your repository. You also have the ability to enable and disable sources. These setting will be reflected on the client UI as well.

Alternatively you can ship keys as environment variables and create these Authentication Method records on application boot via an initializer. Below is an example for facebook.

# Ensure our environment is bootstrapped with a facebook connect app
if ActiveRecord::Base.connection.table_exists? 'spree_authentication_methods'
  Spree::AuthenticationMethod.where(environment: Rails.env, provider: 'facebook').first_or_create do |auth_method|
    auth_method.api_key = ENV['FACEBOOK_APP_ID']
    auth_method.api_secret = ENV['FACEBOOK_APP_SECRET']
    auth_method.active = true
  end
end

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

Setup the Applications at the Respective Sources

OAuth Applications @ Facebook, Twitter and / or Github are supported out of the box but you will need to setup applications are each respective site as follows for public use and for development.

All URLs must be in the form of domain.tld you may add a port as well for development

Facebook

Facebook / Developers / Apps

  1. Name the app what you will and agree to the terms.
  2. Fill out the capcha
  3. Under the Web Site tab
  4. Site URL: http://your_computer.local:3000 for development / http://your-site.com for production
  5. Site domain: your-computer.local / your-site.com respectively

Twitter

Twitter / Application Management / Create an application

  1. Name and Description must be filled in with something
  2. Application Website: http://your_computer.local:3000 for development / http://your-site.com for production
  3. Application Type: Browser
  4. Callback URL: http://your_computer.local:3000 for development / http://your-site.com for production
  5. Default Access Type: Read & Write
  6. Save Application

Github

Github / Applications / Register a new OAuth application

  1. Name The Application
  2. Main URL: http://your_computer.local:3000 for development / http://your-site.com for production
  3. Callback URL: http://your_computer.local:3000 for development / http://your-site.com for production
  4. Click Create

This does not seem to be a listed Github item right now. To View and / or edit your applications goto http://github.com/account/applications

Other OAuth sources that are currently supported

  • Google (OAuth)

Contributing

In the spirit of free software, everyone is encouraged to help improve this project.

Here are some ways you can contribute:

  • by using prerelease versions
  • by reporting bugs
  • by suggesting new features
  • by writing translations
  • by writing or editing documentation
  • by writing specifications
  • by writing code (no patch is too small: fix typos, add comments, clean up inconsistent whitespace)
  • by refactoring code
  • by resolving issues
  • by reviewing patches

Starting point:

  • Fork the repo
  • Clone your repo
  • Run bundle install
  • Run bundle exec rake test_app to create the test application in spec/test_app
  • Make your changes
  • Ensure specs pass by running bundle exec rspec spec
  • Submit your pull request

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

spree_social's People

Contributors

lbrapid avatar radar avatar sbounmy avatar jdutil avatar futhr avatar geekoncoffee avatar jackkinsella avatar wuboy0307 avatar jschwertfeger avatar swrobel avatar ph1ll avatar parndt avatar dpritchett avatar tomkrus avatar jpablobr avatar samsonite16 avatar alexandremcosta avatar suryart avatar traels avatar mrpollo avatar ramprasadg avatar uranazo avatar jparbros avatar jhawthorn avatar johanb avatar jsqu99 avatar daemonsy avatar cassioscabral avatar bryanmtl avatar alexkob avatar

Watchers

 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.