GithubHelp home page GithubHelp logo

gabrielnaoto / grape-devise Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pluff/grape-devise

0.0 1.0 0.0 152 KB

Devise integration gem for Grape API framework

License: MIT License

Ruby 100.00%

grape-devise's Introduction

Grape::Devise

This gem attempts to integrate Devise into Grape in native Grape fashion. Devise has great model modules, warden strategies etc so it's really tempts to use it when building APIs. However devise controller layer doesn't fit well with Grape. Here where grape-devise comes to the rescue.

Gem benifits:

  • native Grape integration
  • ready-to-use set of helpers as well-known current_user

Installation

Add this line to your application's Gemfile:

gem 'grape-devise'

And then execute:

$ bundle

Or install it yourself as:

$ gem install grape-devise

Usage

  1. First of all you need to setup devise as usual. See ( https://github.com/plataformatec/devise#getting-started )
  2. Add Grape::Devise::Helpers helpers and include Grape::Devise::Endpoints module into your API endpoints class e.g.
class MyApi < Grape::API
  helpers Grape::Devise::Helpers
  include Grape::Devise::Endpoints
end
  1. Remove Devise routes from routes.rb file. We will use Grape-styled endpoints for our API, not default Rails routes.
  2. Add Devise.add_mapping(:users, {}) to your devise.rb initializer. Consider replacing :users with appropriate symbol of your devise resource.
  3. Restart your server

TODO

  • Add support for every Devise module. Currently we have endpoints only for :database_authenticatable
  • Create Rails generator
  • Improve test coverage

Contributing

  1. Fork it ( https://github.com/pluff/grape-devise/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

grape-devise's People

Contributors

pluff avatar

Watchers

James Cloos 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.