Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update doorkeeper to be used with grape >= 0.10 #915

Merged

Conversation

tim-vandecasteele
Copy link
Contributor

Grape has since long discouraged the use of options[:route_options] for custom additions. Since version 0.10 it cannot be used anymore like setup in the helpers in doorkeeper (grape is currently at 0.19.1).

This PR fixes the behaviour to properly work with grape, and describes a bit better in the example how you could actually use it and set it up (if you want I can elaborate more in the readme).

I think with this example and the change, most people should have enough with doorkeeper as is, and not need wine_bouncer at all.

extend ::Grape::API::Helpers
include Doorkeeper::Rails::Helpers

# endpoint specific scopes > parameter scopes > default scopes
def doorkeeper_authorize!(*scopes)
endpoint_scopes = env['api.endpoint'].options[:route_options][:scopes]
endpoint_scopes = env['api.endpoint'].route_setting(:scopes)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Grape has since long discouraged the use of options[:route_options] for custom additions. Since version 0.10 it cannot be used anymore like setup in the helpers in doorkeeper (grape is currently at 0.19.1).

This PR fixes the behaviour to properly work with grape, and describes a bit better in the example how you could actually use it and set it up (if you want I can elaborate more in the readme).

I think with this example and the change, most people should have enough with doorkeeper as is, and not need wine_bouncer at all.
@tute tute merged commit 4634bcb into doorkeeper-gem:master Jan 11, 2017
@tute
Copy link
Contributor

tute commented Jan 11, 2017

Thank you! :)

@tim-vandecasteele
Copy link
Contributor Author

Thanks for merging :)

@tim-vandecasteele tim-vandecasteele deleted the update-grape-and-example branch January 11, 2017 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants