Turkish chars in name in JWT cause "JWT error: Invalid token"

I am trying to integrate Jitsi with my system written in Java. There were no problems, user “Mehmet Gülek” was able to login. But I realized that another user, whose name contains character ö cannot login.

I tried

URLEncoder.encode(name, “UTF-8”).replace("+", “%20”);

transformation on name, according to a post. Now nobody can login.

The JWT payload was something like (before transformation) :

{“iss”:“comp-jitsi”,“sub”:"*",“aud”:“comp-jitsi”,“room”:“a4f68782-0d1b-4d05-af6f-f957afb36d2f”,“exp”:1643009017,“iat”:1643008717,“nbf”:1643008717,“context”:{“id”:“ccg”,“name”:“Cem Cangöz”,“avatar”:“avatarurl”,“email”:“a@b.com”}}

It works on my environment when I create the token on jitok.emrah.com

In my setting there is id and name. In your setting there is only username. ? What is username? Is it id?

You may check the content of the created JWT on jwt.io. Your token’s format is not correct.

I have modified my payload according to jitok.emrah.com.

Now my payload is

{“iss”:“comp-jitsi”,“sub”:"*",“aud”:“comp-jitsi”,“room”:“b863d347-2527-47cb-a12e-a2b68cecc95a”,“exp”:1643093311,“iat”:1643093011,“nbf”:1643093011,“context”:{“user”:{“name”:“Mehmet Gülek”,“avatar”:“https://unsplash.com/photos/zDDdoYqQ64U",“email”:"a@b.com”}}}

Still the same error. Nothing useful in prosody log.

Full error log is

2022-01-25T07:09:13.597Z [connection.js] <a.o>: CONNECTION FAILED: connection.passwordRequired
Logger.js:154 2022-01-25T07:09:13.598Z [features/base/conference] JWT error: Invalid token
Logger.js:154 2022-01-25T07:09:13.624Z [features/base/connection] connection.passwordRequired

at chrome developer tools.

Can you login using a token from jitok?

It worked!

The only difference between my token and yours is that, my token specifies room and includes nbf.

I checked my token on jwt.io. It turned out that my token is quite strange. I think it will be OK when I fix it.

It is OK now :slight_smile: Thanks Emrah…

1 Like