Unauthorized error in iOS/Android SDK



Publication le 18 févr. 2022

We are trying to integrate the Zendesk support SDK in iOS and Android platforms for Guide, Tickets, and Chat features. As per the documentation, we are integrated the Support SDK, Enabled the JWT authentication, and configured the backend APIs and client code as per the documentation.

From the mobile side, we are updating identity as JWT token same as the below-mentioned code.

Zendesk.initialize(appId: "1e41a02a5f85d58e009ed4fa", clientId: "mobile_sdk_client_e1c4e6262f1d02f43496",zendeskUrl: "https://omniwear.zendesk.com");
let token = Identity.createJwt(token: "unique_db_user_identifier")
Zendesk.instance?.setIdentity(token)

While trying to show the Guides screen the same as below mentioned code we are getting "unauthorized" from SDK.  Please find more details below.

Code:

let helpCenter = HelpCenterUi.buildHelpCenterOverviewUi(withConfigs: [])
navigationController?.pushViewController(helpCenter, animated: true)

iOS Error: 

[DEBUG]: Returning cached settings for HelpCenterSettings.Type
[INFO]: Localization key and value : "ios.ZDKHelpCenter.helpCenterOverview.title" = "Help";
[DEBUG]: Reachability Flag Status: -R ------- networkStatusForFlags
[DEBUG]: Returning cached settings for ConversationsSettings.Type
[DEBUG]: Returning cached settings for HelpCenterSettings.Type
[INFO]: Localization key and value : "ios.ZDKHelpCenter.support.contactSupport" = "Contact us";
[INFO]: Localization key and value : "ios.ZDKHelpCenter.support.contactSupport" = "Contact us";
[DEBUG]: Returning cached settings for HelpCenterSettings.Type
[DEBUG]: Returning cached settings for HelpCenterSettings.Type
[DEBUG]: Returning cached settings for CoreSettings.Type
[ERROR]: Login error : Error Domain=com.zendesk.sdk.core Code=1000 "unauthorized" UserInfo={error=Couldn't authenticate you, HTTP Status code=401, NSLocalizedDescription=unauthorized}
[INFO]: Localization key and value : "ios.ZDKHelpCenter.support.contactError" = "Unable to connect";
[INFO]: Localization key and value : "ios.ZDKHelpCenter.toastRetryButton" = "Retry"

 

JWT API response: 

curl "https://<domain>/admin/zendesk/jwt" -d "user_token=harigharan.e@gmail.com" -v -X POST
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying …..
* Connected to … port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=..
*  start date: Jan 18 01:42:49 2022 GMT
*  expire date: Apr 18 01:42:48 2022 GMT
*  subjectAltName: host “..” matched cert's “..”
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
> POST /admin/zendesk/jwt HTTP/1.1
> Host:..
> User-Agent: curl/7.77.0
> Accept: */*
> Content-Length: 33
> Content-Type: application/x-www-form-urlencoded
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.18.0 (Ubuntu)
< Date: Fri, 18 Feb 2022 15:27:09 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 211
< Connection: keep-alive
< Content-Security-Policy: default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests
< X-DNS-Prefetch-Control: off
< Expect-CT: max-age=0
< X-Frame-Options: SAMEORIGIN
< Strict-Transport-Security: max-age=15552000; includeSubDomains
< X-Download-Options: noopen
< X-Content-Type-Options: nosniff
< X-Permitted-Cross-Domain-Policies: none
< Referrer-Policy: no-referrer
< X-XSS-Protection: 0
< Access-Control-Allow-Origin: *
< ETag: W/"d3-ECX7al3yFow40Aa+HPqwW9dVYq8"
< Vary: Accept-Encoding
<
* Connection #0 to host  left intact
{"jwt":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhhcmlnaGFyYW4uZUBnbWFpbC5jb20iLCJuYW1lIjoiSGFyaWdoYXJhbiBFIiwiaWF0IjoxNjQ1MTk4MDI5LCJleHAiOjE2NDUyODQ0Mjl9.tNxFRnm0Gv9NTFPXQhAcOCk3oHECZbsWW-GEe__RSKs"}

 

iOS SDK version:

  - ZendeskChatProvidersSDK (2.11.1)
  - ZendeskChatSDK (2.11.1):
    - ZendeskChatProvidersSDK (~> 2.11.1)
    - ZendeskMessagingSDK (~> 3.8.2)
  - ZendeskCommonUISDK (6.1.1)
  - ZendeskCoreSDK (2.5.1)
  - ZendeskMessagingAPISDK (3.8.2):
    - ZendeskSDKConfigurationsSDK (~> 1.1.8)
  - ZendeskMessagingSDK (3.8.2):
    - ZendeskCommonUISDK (~> 6.1.1)
    - ZendeskMessagingAPISDK (~> 3.8.2)
  - ZendeskSDKConfigurationsSDK (1.1.8)
  - ZendeskSupportProvidersSDK (5.3.0):
    - ZendeskCoreSDK (~> 2.5.1)
  - ZendeskSupportSDK (5.3.0):
    - ZendeskMessagingSDK (~> 3.8.2)
    - ZendeskSupportProvidersSDK (~> 5.3.0)

1

7

0 commentaire

Se connecter pour laisser un commentaire.

Vous ne trouvez pas ce que vous cherchez ?

Nouvelle publication