How do I generate a json web token from construct2

0 favourites
  • 9 posts
From the Asset Store
Creating Artificial Intelligence Games Using Construct2 and Construct3.
  • Hello there!

    I want to ask if someone has experience with construct2/3 / JSON Web Token / webserver highscore list. And how i could setup the communication between construct2 and the target website with JSON Web Token.

    In my game there will be a score generated, which i would have to encode (JSON Web Token), send it to the website, wehre the highsocre table is embedded. The php script should decode the JSON Web Token and set the score into the list.

    * JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties.

    Any ideas or references or tutorial would be great.

    Thank you very much!

  • Someone?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Is this your own webserver or some third-party service like clay.io?

    Do you have any documentation on JSON format required by this service, authentication etc.?

  • dop2000

    Thanks for your answer!

    Its a third-party server, basically from our customer. Basically i have a reference, but iam not so deep in this topic - so i cant say who has to deliver what to get this to run.

    For excample: Do i need to integrate a java library, or do i have to implement something else...in the project, and can construct3 handle this, etc. Thats the main questions i wanted to start asking. Probably you did this in your project and you could tell me the "steps" i would have to pay attention on.

    That would be awesome to understand this materia.

    Thank you very much!

  • It's impossible to say without the documentation.

    You might need to install an addon (like this one) to parse JSON strings.

  • dop2000

    Thank you for the information - the plugin isn´t available for construct3 i guess. Do you know alternatives?

    Documentation Link:

    https://jwt.io/

    But the basic question i have is how to use this (i think there are several pages like i included above) method with construct3.

    It should be possible with get and post functions but to use this encoding it shouldn´t be a post command to an extern library, because this could be manipulated too (to avoid this is the basic function of this token), so i guess i would have to have a kind of library in my root folder and use a "encode my variable and send it to url" function...

    but iam absolutly not sure with my intention. Maybe i get something wrong in understanding this thing...

    Thats why iam asking for helping people like you <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Note: I saw, that the question is how to do this in construct2 but i made the project with construct3

  • So the communication is encrypted.. Then you are probably right, you will need a plugin or JS function that will handle encryption.

  • dop2000

    okay - have to take a look how to do this - did you got some experience with that?

  • Nope, sorry. I really though this was something simple like sending JSON in clear text.

    There are several JS libraries available on jwt.io website, so I guess you need to find somebody who can make a plugin from that.

    Try posting a request in this forum:

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)