         msg = if payload.message.user then "[#{payload.message.user}] #{payload.message.text}" else "[unknown] #{payload.message}"
         $scope.$apply -> $scope.messages.unshift msg
 
-      # in this app, only supers can see history
-      PubNub.ngHistory { channel: $scope.selectedChannel, count:500 }
-
+      PubNub.ngHistory { channel: $scope.selectedChannel, auth_key: $scope.data.authKey, count:500 }
 
     ### When controller initializes, subscribe to retrieve channels from "control channel" ###
     PubNub.ngSubscribe { channel: $scope.controlChannel }

      # different/separate auth keys should be distributed by the server and used
      # for user authentication.
      #
      $rootScope.secretKey = if $scope.data.super then 'sec-c-ZTMxNWNmMjQtYmZhNC00YWVlLWI1MjMtODEzZWQ0M2UwZjQx' else null
      $rootScope.authKey   = if $scope.data.super then 'ChooseABetterSecret' else null

      PubNub.init({
        subscribe_key : 'sub-c-340a3e8a-6211-11e3-938a-02ee2ddab7fe'
        publish_key   : 'pub-c-2e22d352-c3ee-4056-b31c-915599024941'
        # WARNING: DEMO purposes only, never provide secret key in a real web application!
        secret_key    : $rootScope.secretKey
        auth_key      : $rootScope.authKey

      $scope.selectedChannel = channel
      $scope.messages = ['Welcome to ' + channel]

      PubNub.ngSubscribe { channel: $scope.selectedChannel, auth_key: $scope.authKey, error: -> console.log arguments }
      $rootScope.$on PubNub.ngPrsEv($scope.selectedChannel), (ngEvent, payload) ->
        $scope.$apply ->
          $scope.users = PubNub.map PubNub.ngListPresence($scope.selectedChannel), (x) -> x.replace(/\w+__/, "")
