Skip to content

Instantly share code, notes, and snippets.

@TakuyaHarayama
Created June 6, 2018 05:42
Show Gist options
  • Save TakuyaHarayama/783b221a7daee261620fc3437330d829 to your computer and use it in GitHub Desktop.
Save TakuyaHarayama/783b221a7daee261620fc3437330d829 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