Use PubNub Access Manager for Access Control.      

Below is a diagram which shows basic key exchange.      

auth_client.png