Failed to decode JWT | Community
Skip to main content

Failed to decode JWT

  • June 2, 2022
  • 8 replies
  • 0 views

Toan11

Hi you guys,

I took the steps according to the documentation to enable authenticated visitors for messaging with Zendesk SDKs. https://developer.zendesk.com/documentation/zendesk-web-widget-sdks/sdks/web/enabling_auth_visitors/?_ga=2.268652913.1675815841.1654150203-1035270265.1654150203. But I experienced a problem as below. Give me some help to solve the thing, please 

8 replies

Eric27
  • June 2, 2022
Hey Toan,

Can you share the corresponding code snippets so we can see how you're handling the JWT? 
 
Thanks 

Toan11
  • Author
  • June 2, 2022

We build the mobile app, which integrated with Zendesk, by using flutter library dart_jsonwebtoken


Eric27
  • June 2, 2022
Hey Toan,

Unfortunately we don't support flutter, so the amount of debugging I can do is pretty limited. Have you checked to see if the JSON can be properly decoded using a tool like JWT.io? This may help you to isolate where the request is being malformed. Lastly, I've went ahead and deleted your code snippet as it shows your keys.

Apologies for not being able to be more assistance.

Tej
  • January 24, 2024

@toan11 Did you manage to fix the issue ?


Sion
  • February 5, 2025

I'm getting: The JWT provided could not be decoded when trying to log in.

The JWT token is decoded as it should (via JWT.io).

I'm using the latest iOS SDK version - ZendeskSDKMessaging - 2.27.0

 

The secret and the kidare defined and used to construct the JWT token. Any idea what I've missed?


Sion
  • February 5, 2025

Just to add: 

The Zendesk is initialized before logging in. 

Zendesk.initialize(withChannelKey: Constants.channelKey,
                           messagingFactory: DefaultMessagingFactory()) { result in
            switch result {
            case .success(let zendesk): 
            	// Here I login with new JWT token generated by our server
            	login()
            case .failure(let error): break
            }
        }

  • February 24, 2025

Hi Sion, 

 

Are you still having this issue? If so, I can pull you into a ticket to get a better look. 


Sion
  • February 25, 2025

already have a ticket opened and waiting for help