You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use Middleware::Auth::Base to add my own strategies by Grape::Middleware::Auth::Strategies.add(), but this line returned the rack response [400, foo, bar].
The two file like this:
require'rack/auth/abstract/handler'require'rack/auth/abstract/request'require'grape/middleware/auth/base'# Rack::Auth::Basic implements HTTP Basic Authentication, as per RFC 2617.## Initialize with the Rack application that you want protecting,# and a block that checks if a username and password pair are valid.## See also: <tt>example/protectedlobster.rb</tt>classOAuthMiddleware < Rack::Auth::AbstractHandlerdefcall(env)oauth=OAuthMiddleware::Request.new(env)returnunauthorizedunlessoauth.provided?returnbad_requestunlessoauth.basic?ifvalid?(oauth)env['REMOTE_USER']=oauth.usernamereturn@app.call(env)endunauthorizedendprivatedefchallenge'Basic realm="%s"' % realmenddefvalid?(auth)@authenticator.call(*auth.credentials)endclassRequest < Rack::Auth::AbstractRequestdefbasic?"OAuth.Github".downcase == schemeenddefcredentials@credentials ||= params.unpack("m*").first.split(/:/,2)enddefusername@credentials.firstendendend
Looks like an exception was raised inside the call, then handled. Maybe build a smaller project without the whole oauth thing that demonstrates the problem?
I am trying to use Middleware::Auth::Base to add my own strategies by
Grape::Middleware::Auth::Strategies.add()
, but this line returned the rack response [400, foo, bar].The two file like this:
Where is the error? Is there any demo or more detailed docs than this README?
The text was updated successfully, but these errors were encountered: