Rails two-legged OAuth provider?

前端 未结 2 1785
悲哀的现实
悲哀的现实 2021-02-06 14:02

I have a rails 2.3.5 application with an API I wish to protect.

There is no user - it is an app to app style webservice (more like an Amazon service than facebook), and

2条回答
  •  日久生厌
    2021-02-06 14:37

    Previously, the only good answer was to hack about in the oauth-plugin to get this subset of the oauth interaction. Since then, the oauth-plugin was refactored, and now you can use it straight up, just by adding the right type of authentication filter to your controller:

    class ApiController < ApplicationController
    
        include OAuth::Controllers::ApplicationControllerMethods
    
        oauthenticate :strategies => :two_legged, :interactive => false
    
        # ...
    
    end
    

提交回复
热议问题