       uuid          : KD.whoami()._id
       ssl           : ssl
 
+    realtimeToken = Cookies.get("realtimeToken")
+
+    @pubnub.auth realtimeToken  if realtimeToken?
+
+
   # channel authentication is needed for notification channel and
   # private channels
   authenticate: (options, callback) ->


      return callback err  if err

      realtimeToken = Cookies.get("realtimeToken")

      return callback { message : 'Could not find realtime token'}  unless realtimeToken

      @pubnub.auth realtimeToken

      channelInstance = new PubnubChannel name: pubnubChannelName

      @pubnub.subscribe

    { endPoint, data } = options
    return callback { message : "endPoint is not set"}  unless endPoint

    KD.utils.doXhrRequest {endPoint, data}, (err) =>

      return callback err  if err

      realtimeToken = Cookies.get("realtimeToken")

      return callback { message : 'Could not find realtime token'}  unless realtimeToken

      @pubnub.auth realtimeToken

      callback null


  # subscriptionData =
