GithubHelp home page GithubHelp logo

grape-doorkeeper's Introduction

grape-doorkeeper

Code Climate endorse

Integration Grape with Doorkeeper

class API < Grape::API
  helpers do
    def current_token; env['api.token'] end
    def current_user; @current_user ||= Acl::User.find(current_token.resource_owner_id) if current_token end
  end
  
  doorkeeper_for :all, scopes: [:read]
  
  get :hello do
    {:hello => current_user.email }
  end
  
  get :by, protected: false do
    {:by => 1 }
  end

  # Use a different scope for this endpoint.
  get :bar, scopes: [:write] do
    {:bar=> 1 }
  end
  
  resource :statuses do
    get :count do
      {:count => 0 }
    end  
    
  end
end

grape-doorkeeper's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

grape-doorkeeper's Issues

Error when i use doorkeeper_for

Hi,

I have an error when I try to use doorkeeper_for in my files.
ERROR NoMethodError: undefined method `split' for nil:NilClass

WWW-Authenticate - bad auth-scheme value "Bearer"

Hello,
I have just noticed that if there is an Authentication error the response includes the WWW-Authenticate header like WWW-authenticate OAuth realm='OAuth API', error='invalid_token'

According to the specification https://tools.ietf.org/html/rfc6750#page-7 it should use Bearer. It looks like OAuth is not a valid auth-scheme. Can someone confirm?

Some of the browsers seem to initiate a Basic-auth if the response contains OAuth (ex. Safari Version 8.0.8 on OS X Yosemite version 10.10.5). It might be that OAuth is not recognized and the browser falls back to a default.

Best regards,
Dan

error when requesting api

When trying to call my api with a valid access token I get the following error.

{message":"private method `scopes' called for #\u003cDoorkeeper::AllDoorkeeperFor:0x595e4f8\u003e"}

Can support doorkeeper 1.4.0

Bundler could not find compatible versions for gem "doorkeeper":
  In Gemfile:
    grape-doorkeeper (~> 0.0.1) ruby depends on
      doorkeeper (~> 0) ruby

    doorkeeper (1.4.0)

Use access_token_methods defined in Doorkeeper

I was initially confused why I couldn't use HTTP Basic Auth to pass in the token, nor using access_token param until I dug through the code to find out how the Grape::Middleware::Auth::OAuth2 worked.

It would be great if this gem would use the same access token methods as per defined in config/initializers/doorkeeper.rb!

Doorkeeper 2.0 & Grape 0.10 support

Hey,

I just wanted to upgrade to doorkeeper 2.0 and grape 0.10 and noticed, that this gem doesn't work anymore. It seems that Doorkeeper::DoorkeeperForBuilder.create_doorkeeper_for(*args) has been removed from doorkeeper.

So, any idea on how to make this work with doorkeeper 2.0? If you have some hints on how to do this, I'll try to transfer it to doorkeeper 2.0 and make a PR

doorkeeper 4.0.0 & grape-doorkeeper 0.0.2 support (for runtime dependency)

Hi,
I am facing below issue while trying to upgrade doorkeeper version from 1.4.0 to 4.0.0 in gemspec file (i.e runtime dependency):
grape-doorkeeper (> 0.0.2) was resolved to 0.0.2, which depends on
doorkeeper (> 1.4.0)

Can anyone help me please how can I upgrade doorkeeper version with grape-doorkeeper?

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.