{"id":36534945,"url":"https://github.com/stackitcloud/fake-jwt-server","last_synced_at":"2026-01-12T03:11:20.678Z","repository":{"id":233289539,"uuid":"786441081","full_name":"stackitcloud/fake-jwt-server","owner":"stackitcloud","description":null,"archived":false,"fork":false,"pushed_at":"2025-12-23T17:40:21.000Z","size":206,"stargazers_count":7,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-24T07:55:55.121Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackitcloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-14T13:28:05.000Z","updated_at":"2025-12-12T03:07:59.000Z","dependencies_parsed_at":"2024-08-21T23:54:12.709Z","dependency_job_id":"96f7cadc-9532-4fce-9c21-2b068e5c7c34","html_url":"https://github.com/stackitcloud/fake-jwt-server","commit_stats":null,"previous_names":["stackitcloud/fake-jwt-server"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/stackitcloud/fake-jwt-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackitcloud%2Ffake-jwt-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackitcloud%2Ffake-jwt-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackitcloud%2Ffake-jwt-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackitcloud%2Ffake-jwt-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackitcloud","download_url":"https://codeload.github.com/stackitcloud/fake-jwt-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackitcloud%2Ffake-jwt-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28333050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-01-12T03:11:19.875Z","updated_at":"2026-01-12T03:11:20.672Z","avatar_url":"https://github.com/stackitcloud.png","language":"Go","readme":"# Introduction\n\nA straightforward mock-up of an identity provider (IDP) is designed to issue JWTs, enhancing the security of\ncommunications between services.\n\n![fake-jwt-server-illustration](./media/fake-jwt-illustration.png)\n\nTo safeguard service interactions, various methods are available such as mutual TLS, basic authentication, or bearer\nauthentication, to name a few. In bearer authentication, a token is required from an IDP, like Keycloak or Okta, through\nthe client credentials grant of OAuth 2.0. Once the JWT is acquired, it can be transmitted in the authorization header\nwhen a service communicates with another. The recipient service can then verify the token using the IDP's public key.\nDuring local development or integration testing, utilizing a real IDP may not be desirable. This is where the concept of\na fake-jwt-server is introduced. It's a basic version of an IDP that issues JWTs for OAuth flows and provides a public\nkey endpoint for token verification.\n\n# Running the Server\n\nTo launch the server in a Docker container, execute the following command:\n\n```bash\ndocker run -p 8008:8008 ghcr.io/stackitcloud/fake-jwt-server:v0.1.1\n```\n\nThis command initializes the server on port 8008. The public key can be accessed\nat http://localhost:8008/.well-known/jwks.json, and the OAuth token endpoint is available\nat http://localhost:8008/token.\n\n# Configuration\n\nThe server's settings can be adjusted using specified environment variables and flags.\n\n| Environment Variable | Flag                   | Description                                                               |\n|----------------------|------------------------|---------------------------------------------------------------------------|\n| `PORT`               | `--port`               | The port the server listens on. Defaults to `8008`.                       |\n| `ISSUER`             | `--issuer`             | The issuer of the tokens. Defaults to `test`.                             |\n| `AUDIENCE`           | `--audience `          | The audience of the tokens. Defaults to `test `.                          |\n| `SUBJECT`            | `--subject`            | The subject of the tokens. Defaults to `test`                             |\n| `ID`                 | `--id`                 | The id of the tokens. Defaults to `test`.                                 |\n| `EXPIRES_IN_MINUTES` | `--expires-in-minutes` | The expiration time of the JWT tokens in minutes. Defaults to `52560000`. |\n| `GRAND_TYPE`         | `--grand-type`         | The grand type of the JWT tokens. Defaults to `client_credentials`.       |\n| `EMAIL`              | `--email`              | The email of the JWT token. Defaults to `test@example.com`.               |\n\n# Collaboration with Bruno\n\n\nBruno is our favourite request testing tool.\n\nhttps://docs.usebruno.com/introduction/what-is-bruno\n\nTherefore, an introduction to how the tokens can be integrated into Bruno.\n\nThe workflow is as follows Brono will perform a pre-request against the fake-jwt-server before each request and add the token as header to the actual request.\n\n## Script\n\n```javascript\nconst tokenUrl = 'http://localhost:8008/token';\ntry {\n    let resp = await axios({\n        method: 'POST',\n        url: tokenUrl,\n    });\n    bru.setVar('ACCESS_TOKEN', resp.data.access_token);\n} catch (error) {\n    throw error;\n}\n```\n\n## Integration\n\nYou can make settings for the entire collection.\nThe script above is stored in this as a pre-request script.\n![bruno - collection script](./media/bruno-collection-script.png)\n\nThe token is stored in the variable ACCESS_TOKEN in the script.\n\nThis must be added to the requests as a header.\n![bruno - collection headers](./media/bruno-collection-headers.png)\n\n## Non Local Environment\n\nThe following script can be used to set the token depending on the environment.\nI am not yet fully satisfied with this solution, so I will update the readme when new findings come to light.\n```javascript\nif (!bru.getEnvName(\"local\")) {\n    bru.setVar('ACCESS_TOKEN', \"\");\n    return\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackitcloud%2Ffake-jwt-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackitcloud%2Ffake-jwt-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackitcloud%2Ffake-jwt-server/lists"}