Skip to content

Instantly share code, notes, and snippets.

@evanjmg
Created July 9, 2016 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanjmg/31381cc7abb8d623c9ee242f8b91ebe6 to your computer and use it in GitHub Desktop.
Save evanjmg/31381cc7abb8d623c9ee242f8b91ebe6 to your computer and use it in GitHub Desktop.
# in routes.rb add your endpoint
post 'pusher/auth', to: "pusher#auth"
# create a pusher_controller.rb in your api
class Api::V1::PusherController < Api::V1::BaseController
skip_authorization_check
skip_before_filter :check_api_auth!, only: [:auth]
def auth
if current_user
response = Pusher.authenticate(params[:channel_name], params[:socket_id])
render json: response
else
head :forbidden
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment