Jitok: Jitsi Token generator

jitok

jitok is a simple token generator for Jitsi.

ui

Check jitok.emrah.com for a simple UI.

api

curl -sX POST -H "Content-Type: application/json" \
    -d '{ "secret": "mysecret", "aud": "myapp", "exp": 3600 }' \
    https://jitok.emrah.com/api
  • alg (optional)
    the algorithm
    possible values: HS512 or HS256
    default: HS512

  • secret
    the secret key

  • aud
    the application identifier

  • iss (optional)
    issuer
    default: get the aud value

  • sub (optional)
    the tenant
    default: *

  • room (optional)
    the allowed room
    default: *

  • exp (optional)
    the expiration time in seconds
    default: 3600

  • name (optional)
    the username

  • email (optional)
    the email address

  • avatar (optional)
    the avatar link

  • affi (optional)
    the affiliation
    possible values: owner, moderator, teacher
    any other values will be set as member

  • rec (optional)
    Enable recording
    possible values: true or false

  • live (optional)
    Enable livestreaming
    possible values: true or false

  • screen (optional)
    Enable screen-sharing
    possible values: true or false

7 Likes

1 Like

Very nice! Is this open source?

I added it here, cheers! Third-party Software · Jitsi Meet Handbook

1 Like

Yes, it’s open source.
This is the related folder in GitHub

well, I think that you are supposed to add a ‘License’ file somewhere (maybe I missed it), just publishing the source is not considered as ‘open source’ -it’s a lawyer’s world :slight_smile:

1 Like

added

Nice! Also, Deno! :heart:

1 Like

Hello @emrah ! Question, what is the plugin you have to use to validate the token? And, how is this sent from the UI?

hello @acruz,

This script creates the token, not validates… If you want to validate (verify) the token in deno then check this

Thanks for your response @emrah !!!

I was thinking more how to use this JWT to authenticate the user against prosody. Like:

  1. My app creates a similar token
  2. The jitsi ui sends it to prosody
  3. How prosody uses it? Do you have to install an specific plugin?

Check this topic and the codes of the prosody modules which are linked in it

1 Like

jitok.emrah.com

I updated the Jitok UI. Switched to sveltekit

3 Likes

Greetings emrah, I want to use this script for my test application on my own server. How can I do this? After cloning and installing the project, I changed the host name, but I did not receive a response when I made a request. can you help @emrah

There are two parts:

Each part has its own deployment and running instructions. Did you check them?

yes, I just want to run the api part on my own server, I followed the instructions in the api part. I just changed the parts below. When I run it with bash command, it listens on the port, but when I make a request, I can’t get any results.
Ekran Resmi 2022-09-19 16.26.21

Do I need to do anything other than the above changes, how should I proceed?
Thank you very much for your quick turnaround. @emrah

What is the output for the following command:

curl -X POST http://127.0.0.1:9000/api

I’m getting “NotImplemented”, actually I think this result shows that it’s working, but why don’t I get a response when I send a request with postman? @emrah There is cloudflare ssl on the server, could it be because I didn’t open it as https?

Yes, this means it is working

For a very simple test, you can do the followings:

JSON=$(cat <<EOF
{
  "alg":"HS256",
  "secret":"myappsecret",
  "aud":"myappid",
  "room":"*",
  "exp":3600
}
EOF
)

curl -H "Content-Type: application/json" -d "$JSON" http://127.0.0.1:9000/api

The backend may be HTTP depending on your deployment environment