Skip to content

Instantly share code, notes, and snippets.

@TakuyaHarayama
Created June 6, 2018 05:42
Show Gist options
  • Save TakuyaHarayama/e0a1893d56862ee179a5c7ee47ad4cf0 to your computer and use it in GitHub Desktop.
Save TakuyaHarayama/e0a1893d56862ee179a5c7ee47ad4cf0 to your computer and use it in GitHub Desktop.
GraphqlとKnockを使った認証処理 https://github.com/nsarno/knock/issues/194
class GraphqlController < ActionController::Base
include Knock::Authenticable
before_action :authenticate
def execute
# snip...
context = {
# Query context - +current_user+ is available when authenticated:
current_user: current_user,
}
# snip...
render json: result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment