Recent searches
No recent searches
Login Error in iOS/Android SDK
Posted Apr 20, 2022
I have integrated mobile iOS SDK.
Initialise SDK with :
Zendesk.initialize(appId: "my_app_id", clientId: "my_client_id", zendeskUrl: "my_url")
Support.initialize(withZendesk: Zendesk.instance)
Then set identity :
let identity = Identity.createJwt(token: userId)
Zendesk.instance?.setIdentity(identity)
In console it shows identity has been set.
But whenever I tried to create ticket it says :
[ERROR] : Login error : Error Domain=com.zendesk.sdk.core Code=1000 "unauthorized" UserInfo={error=Couldn't authenticate you, HTTP Status code=401, NSLocalizedDescription=unauthorized}
function to create ticket :
func buildCreateRequest(callback: @escaping (ZDKCreateRequest) -> Void) {
let request = ZDKCreateRequest()
request.subject = subjectTextField.text ?? requestConfig.subject
request.requestDescription = descriptionTextView.text ?? "Default: The problem of the ticket"
request.tags = requestConfig.tags
request.customFields = getCustomFields()
if(self.attachmentImageView.image != UIImage.init(named: "picture"))
{
uploadAttachment { (attachment) in
if let attachment = attachment {
request.attachments.append(attachment)
}
callback(request)
}
}
else
{
callback(request)
}
}
Request to create ticket :
buildCreateRequest {
ZDKRequestProvider().createRequest($0) { [unowned self] (result, error) in
DispatchQueue.main.async {
VIEWMANAGER.hideActivityIndicator()
if result != nil {
VIEWMANAGER.showToast("Ticket updated successfully")
}
if error != nil {
VIEWMANAGER.showToast("Failed to update ticket")
}
}
}
}
Please note : above error is not happening with every user. It happens for some random users.
0
1 comment
Zendesk PhotoSì
Hi, probably I've got the same problem.


When you call Identity.createJwt(), do you get a valid token?
0