Turtlenecksweater
Turtlenecksweater

Reputation: 33

Connect to Pusher ChatKit [Swift]

I am attempting to connect to pusher chatkit; however, everytime I attempt the connection I am receiving this response:

"Making attempt 5 of 6 in 16.0s. Error was: Bad response status code received: 401 with error message: services/chatkit_authorizer/authorization/missing_permission: User does not have access to requested resource"

After it makes 6 attempts it then connects, so I am not sure what the missing permission is.

Below is the code I am using to connect.

 self.chatManagerDelegate = MyChatManagerDelegate()

        chatManager = ChatManager(instanceLocator: Pusher_Chatkit.instanceLocator,
                                  tokenProvider: PCTokenProvider(url: Pusher_Chatkit.tokenProvider),
                                  userID: "user-id")

        chatManager.connect(delegate: chatManagerDelegate!) { currentUser, error in
            guard error == nil else {
                print("Error connecting: \(error!.localizedDescription)")
                return
            }
            print("Successfully connected")

Upvotes: 1

Views: 179

Answers (1)

hamchapman
hamchapman

Reputation: 3341

Make sure that you have the cursors:read:get permission enabled for the role that the user is trying to connect with. You can do this using the dashboard, one of our server SDKs, or the API directly.

Without this permission enabled the connection attempt will currently fail as all clients try to establish a subscription to receive read cursor updates, even if you don't use the read cursor functionality anywhere else in your app.

Upvotes: 0

Related Questions