lib/wine_bouncer/oauth2.rb in wine_bouncer-0.1.2 vs lib/wine_bouncer/oauth2.rb in wine_bouncer-0.2.0

- old
+ new

@@ -77,17 +77,16 @@ def doorkeeper_authorize!(*scopes) scopes = Doorkeeper.configuration.default_scopes if scopes.empty? unless valid_doorkeeper_token?(*scopes) if !doorkeeper_token || !doorkeeper_token.accessible? error = Doorkeeper::OAuth::InvalidTokenResponse.from_access_token(doorkeeper_token) + # TODO: localization and better error reporting raise WineBouncer::Errors::OAuthUnauthorizedError, 'unauthorized' else error = Doorkeeper::OAuth::ForbiddenTokenResponse.from_scopes(scopes) + # TODO: localization and better error reporting raise WineBouncer::Errors::OAuthForbiddenError, "missing permissions" end - - # headers.merge!(error.headers.reject { |k| ['Content-Type'].include? k }) - # doorkeeper_error_renderer(error, options) end end ############ # Grape middleware methods