{"id":19086801,"url":"https://github.com/jangbl/jwt-server-to-server","last_synced_at":"2025-04-30T09:45:56.941Z","repository":{"id":42790724,"uuid":"258984323","full_name":"jangbl/jwt-server-to-server","owner":"jangbl","description":"JSON Web Tokens (JWT) server to server communication with Node.js servers","archived":false,"fork":false,"pushed_at":"2023-05-13T10:55:14.000Z","size":446,"stargazers_count":10,"open_issues_count":10,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T00:41:09.384Z","etag":null,"topics":["hmac","hmac-sha256","hs256","javascript","json-web-signature","json-web-token","json-web-tokens","jws","jwt","jwt-authentication","jwt-bearer-tokens","jwt-middleware","jwt-token","node","node-js","nodejs","rs256","server-to-server","server2server","tutorial"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jangbl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-26T08:57:30.000Z","updated_at":"2023-06-20T22:47:05.000Z","dependencies_parsed_at":"2024-10-03T21:48:01.293Z","dependency_job_id":null,"html_url":"https://github.com/jangbl/jwt-server-to-server","commit_stats":null,"previous_names":["jangbl/jwt-server-to-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jangbl%2Fjwt-server-to-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jangbl%2Fjwt-server-to-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jangbl%2Fjwt-server-to-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jangbl%2Fjwt-server-to-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jangbl","download_url":"https://codeload.github.com/jangbl/jwt-server-to-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251678125,"owners_count":21626288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hmac","hmac-sha256","hs256","javascript","json-web-signature","json-web-token","json-web-tokens","jws","jwt","jwt-authentication","jwt-bearer-tokens","jwt-middleware","jwt-token","node","node-js","nodejs","rs256","server-to-server","server2server","tutorial"],"created_at":"2024-11-09T03:00:25.543Z","updated_at":"2025-04-30T09:45:56.861Z","avatar_url":"https://github.com/jangbl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JWT server to server communication in Node.js\n\n## About\n\nThis repository is the source code for the [JWT server to server communication in Node.js tutorial series on Youtube](https://www.youtube.com/playlist?list=PL1Nml43UBm6dge_ykMszBCtaSJ9RnxQNJ) on YouTube provided by [productioncoder.com](https://productioncoder.com).\n\n\u003ch3 align=\"center\"\u003ePlease help this repo with a ⭐️ if you find it useful! 😁\u003c/h3\u003e\n\n[![JWT server to server communication](images/jwt-server-to-server.png)](https://www.youtube.com/playlist?list=PL1Nml43UBm6dge_ykMszBCtaSJ9RnxQNJ)\n\nFor updates, please follow [@_jgoebel](https://twitter.com/_jgoebel) on Twitter.\n\n## 2 How to run this application\n\n### 2.1 Install dependencies\n\nInstall the dependencies by running\n\n```\nnpm install\n```\n\n### 2.2 HMAC communication\n\nTo initiate an HMAC server to server communication, you need to spin up two server so they can talk to each other\n\nWe recommend opening two terminal windows for this. In the first terminal run\n\n```\nnpm run serverA\n```\n\nIn the second terminal window run:\n\n```\nnpm run serverB\n```\n\nYou now have two servers running on port `3000` and on port `8080`.\n\n### 2.3. RSA-based server to server communication\n\nMake sure that you create two RSA keypairs and paste it in the root directory with the following file names\n\n```\nserverA-private.key\nserverA-public.key\nserverB-private.key\nserverB-public.key\n```\n\nIf you do not want to generate an RSA keypair with openssl via the command line, you can use an online service like [jsencrypt](https://travistidwell.com/jsencrypt/demo/index.html) if you just want to try out the project locally.\n\n### 2.4. Let the servers talk to each other\n\nTo let one server send a message to the other server, you can hit the following unprotected `REST` endpoint with curl or with Postman:\n\n```\nPOST localhost:8080/produce\n```\n\nNote that both servers support the `POST /produce` endpoint. Therfore, you can also hit\n\n```\nPOST localhost:3000/produce\n```\n\nBoth servers will not print log messages that indicate that they just exchanged information with `JWT` tokens in the header.\n\n### 3 Security\n\nTo make this communcation truly secure, we would need to make use of a secure transport protocol such as `https`.\n\nSince this is a tutorial and we did not want to complicate it further by using self-signed certificates, we just use `http` for the sake of simplicity.\n\nWe do this, so the tutorial is easier to understand. In a \\_production scenario you need to use a secure protocol such as `https` / `TLS` to ensure a secure communication.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjangbl%2Fjwt-server-to-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjangbl%2Fjwt-server-to-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjangbl%2Fjwt-server-to-server/lists"}