Reputation: 11
i am integrating pusher beam with ios app. i am getting error while setting beamCleint user id. i am getting error "Optional(PushNotifications.TokenProviderError.error("[PushNotifications] - Changing the userId
is not allowed."))" any help would be appreciated. thanks in advance
here is my code
let tokenProvider = BeamsTokenProvider(authURL: "............") { () -> AuthData in
let sessionToken = "\(defaults.string(forKey: kUserToken ) ?? "")"
let headers = ["Authorization": "Bearer \(sessionToken)"]
let queryParams: [String: String] = [:]
return AuthData(headers: headers, queryParams: queryParams)
}
self.beamsClient.setUserId("\(userId)", tokenProvider: tokenProvider, completion: { error in
guard error == nil else {
print(error.debugDescription)
return
}
print("Successfully authenticated with Pusher Beams")
}) ```
Upvotes: 0
Views: 711
Reputation: 4091
Have you previously set a userId on this device? You may need to ensure you have cleared the device state using the clearAllState
method. See https://pusher.com/docs/beams/reference/ios#-clearallstate
Upvotes: 1