Skip to Content
ContributingAppsServerTesting tRPC

Testing tRPC

To test our tRPC routes we can use tRPC playground, this is a web based application that allows call the tRPC procedures drectly from the browser.

You can find this tool in the /playground of the server app. Example: “http://127.0.0.1:5001/playground

Setting up headers

To test we need to setup the required headers, these are:

  • Authorization
  • Selected Organization id

In the playground you can setup the headers by clicking in the Settings button in the upper right corner of the playground: Settings

There, we need to add the Authorization header, here you can learn how to get this token. The token you get after signing in is needs to be prefixed with Bearer before the token, like this: Authorization header

After that we need to set the selected-organization-id header, we need to set a real id of an organization. Organization header

Getting the token

To sign in you need to do a POST request to the /auth/signin endpoint with the following body:

{ "formFields": [ { "id": "email", "value": "user_name" // Your username }, { "id": "password", "value": "<password>" // Your password } ] }

From the response you need to get the value of thefront-token header, this is the JWT token you need to use to authenticate in the playground. Token Header

Last updated on