{"id":15155561,"url":"https://github.com/jerryimmouse/ssj_auth","last_synced_at":"2025-10-24T12:30:37.751Z","repository":{"id":253596267,"uuid":"842132096","full_name":"JerryImMouse/ssj_auth","owner":"JerryImMouse","description":"Discord Auth Microservice for Space Station 14","archived":false,"fork":false,"pushed_at":"2024-11-24T19:49:05.000Z","size":202,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T01:08:02.993Z","etag":null,"topics":["auth","discord","discord-oauth","discord-oauth2","docker","dockerfile","express","express-js","gplv3","javascript","oauth","oauth2","space-station","space-station-14","space14","ss-14","ss14","station-14","station14"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JerryImMouse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.TXT","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":"2024-08-13T18:26:45.000Z","updated_at":"2024-11-24T19:49:08.000Z","dependencies_parsed_at":"2024-08-18T02:38:34.202Z","dependency_job_id":"b7fb09e7-8f3b-4f9e-b5b9-e3b5bfdf6a73","html_url":"https://github.com/JerryImMouse/ssj_auth","commit_stats":{"total_commits":37,"total_committers":2,"mean_commits":18.5,"dds":"0.16216216216216217","last_synced_commit":"8e0f0ad4c974f2e4fdf5aaf9a7eb48ca89b07acc"},"previous_names":["jerryimmouse/ssj_auth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerryImMouse%2Fssj_auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerryImMouse%2Fssj_auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerryImMouse%2Fssj_auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerryImMouse%2Fssj_auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JerryImMouse","download_url":"https://codeload.github.com/JerryImMouse/ssj_auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237964447,"owners_count":19394397,"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":["auth","discord","discord-oauth","discord-oauth2","docker","dockerfile","express","express-js","gplv3","javascript","oauth","oauth2","space-station","space-station-14","space14","ss-14","ss14","station-14","station14"],"created_at":"2024-09-26T18:40:18.570Z","updated_at":"2025-10-24T12:30:37.358Z","avatar_url":"https://github.com/JerryImMouse.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SS14 Jerry Auth\n\n\n\u003e [!WARNING]\n\u003e This project is no longer maintained, consider using [TypeAuthD](https://github.com/JerryImMouse/typeauthd) as a replacement\n\n## Table of Contents\n1. [Technical Details](#technical-details)\n2. [Routes](#routes)\n3. [Internal Routes](#internal-routes)\n4. [Docker Support](#docker-support)\n5. [Deploying](#deploying)\n6. [Roadmap](#roadmap)\n\n\nThis tool provides easy-to-use interface to connect discord account with Space Station 14 account.\n\n\u003e [!NOTE]\n\u003e As this tool was developed for S.T.A.L.K.E.R 14 purposes I've included given table, so we could process some sponsor stuff like sponsor crates, etc.\n\n## Technical Details\nAs I said before, this app was developed for S.T.A.L.K.E.R 14 in Space Station, so it have given table you may not need, but it allows to manage some giving stuff inside game once a long time. Like with wipe system.\n\nThis app also supports(of course it is) token refreshing, it checks if token valid every time you make a request, so you can be sure your request will be succeeded.\n\n## Routes\n1. **Generate Link**\n    - `GET /api/link`\n    - **Description:** Generates auth link for user.\n    \n   **Query Parameters:**\n\n   | Name      | Type   | Required | Description                                            |\n   |-----------|--------|----------|--------------------------------------------------------|\n   | userid    | string | Yes      | state parameter for future link, should be SS14 UserId |\n   | api_token | string | Yes      | Api Token of the app for security                      |\n   \n    **Response:**  \n   Status Code: OK(200)\n   ```json\n    {\n      \"link\": \"LINKHERE\"\n    }\n    ```\n\n3. **Get Roles**\n    - `GET /api/roles`\n    - **Description:** Returns user roles on specific guild\n    \n    - **Query Parameters:**\n      \n      | Name      | Type   | Required | Description                                 |\n      |-----------|--------|----------|---------------------------------------------|\n      | userid    | string | Yes      | SS14 UserId of the player to get roles from |\n      | guildid   | string | Yes      | Discord GuildId to get roles from           |\n      | api_token | string | Yes      | Api Token of the app for security           |\n   **Response:**  \n    Status Code: OK(200)\n    ```json\n    {\n      \"roles\": [\"role1\", \"role2\"]\n    }\n    ```\n\n4. **Check Auth**\n    - `GET /api/check`\n    - **Description:** Checks if specific user is authenticated\n    - **Query Parameters:**\n\n      | Name      | Type   | Required | Description                        |\n      |-----------|--------|----------|------------------------------------|\n      | userid    | string | Yes      | SS14 UserId of the player to check |\n      | api_token | string | Yes      | Api Token of the app for security  |\n    **Response:**  \n    Status Code: OK(200) | NotFound(404) - Depending on the result\n\n5. **User retrieve**\n    - `GET /api/user`\n    - **Description:** Retrieves user from database by netUserId or by discordIdd\n    - **Query Parameters:**\n      \n      | Name      | Type   | Required | Description                       |\n      |-----------|--------|----------|-----------------------------------|\n      | id        | string | Yes      | Id of the player to check         |\n      | api_token | string | Yes      | Api Token of the app for security | \n      | method    | string | Yes      | SS14 or Discord method of Id      | \n\n6. **Is Given**\n   - `GET /api/is_given`\n   - **Description:** Checks if given flag is set to 1\n   - **Query Parameters:**\n\n     | Name      | Type   | Required | Description                                                 |\n     |-----------|--------|----------|-------------------------------------------------------------|\n     | userid    | string | Yes      | SS14 UserId of the player to check                          |\n     | api_token | string | Yes      | Api Token of the app for security                           |\n     | method    | string | Yes      | SS14 or Discord, influence on what id server is waiting for |\n   **Response:**  \n   Status Code: OK(200) | No Content(204) - Depending on the result\n\n\n7. **Set Given**\n    - `POST /api/given`\n    - **Description:** Sets given flag\n      - **Query Parameters:**\n\n        | Name      | Type    | Required | Description                                                 |\n        |-----------|---------|----------|-------------------------------------------------------------|\n        | userid    | string  | Yes      | SS14 UserId of the player to check                          |\n        | api_token | string  | Yes      | Api Token of the app for security                           |\n        | method    | string  | Yes      | SS14 or Discord, influence on what id server is waiting for |\n        | given     | integer | Yes      | Flag itself, between 0 and 1                                |\n   **Response:**  \n   Status Code: OK(200)\n\n   \n8. **Wipe Given**\n    - `POST /api/wipe_given`\n    - **Description:** Sets all given flags to 0, for all users\n    - **Query Parameters:**\n\n      | Name      | Type    | Required | Description                        |\n      |-----------|---------|----------|------------------------------------|\n      | api_token | string  | Yes      | Api Token of the app for security  |\n   **Response:**  \n   Status Code: OK(200)\n\n9. **Deletion**\n    - `POST /api/delete`\n    - **Description:** Should be self-explanatory, but this route is turned off by default, set `DELETION_ALLOWED` in .env file to enable it.\n    - **Query Parameters:**\n   \n      | Name      | Type   | Required | Description                       |\n      |-----------|--------|----------|-----------------------------------|\n      | id        | string | Yes      | Id depending on method field      |\n      | method    | string | Yes      | SS14 or Discord(ss14/discord)     |\n      | api_token | string | Yes      | Api Token of the app for security |\n    **Response:**\n    Status Code: OK(200)\n    ```json\n    {\n      \"response\": \"OK\"\n    }\n    ```\n    \n        \n## Internal Routes\n1. **Callback Route**\n    - `GET /auth/callback`\n    - **Description:** Internal route to process auth for users. Add this route for your discord application in callback field.\n   - **Query Parameters:**\n     \n     | Name      | Type   | Required | Description                                         |\n     |-----------|--------|----------|-----------------------------------------------------|\n     | state     | string | Yes      | To be decoded from base64 and represented as userid |\n     | code      | string | Yes      | Discord code to exchange                            |\n\n## Docker Support\nThis app also supports docker, to set it up you just need to clone this repository and build this image by yourself using:\n```bash\ndocker build -t ssj_auth .\n```\nor pull already built one with:\n```bash\ndocker pull jerryimmouse/ssj_auth\n```\n\nThen you'll need to run this image with the following template:\n```dotenv\nCLIENT_API_PORT=2424\n\nNODE_ENV=production\n\nAPI_KEY=TOKEN\nDISCORD_API_ENDPOINT=https://discord.com/api/v10\nCLIENT_ID=CLIENTID\nCLIENT_SECRET=CLIENT_SECRET\nREDIRECT_URI=http://127.0.0.1:2424/auth/callback\nDISCORD_AUTH_LINK_TEMPLATE=https://discord.com/oauth2/authorize\n\nUSE_GIVEN=0\nUSE_CACHE=1\nCACHE_MAX_SIZE=100\nCACHE_UPDATE_TIMEOUT=3600\nIS_IN_GUILD=1\nGUILD_ID=GUILD_ID\n\nDELETION_ALLOWED=0 # 0/1\n```\n\nAlso you'd like to expose database file via\n```bash\ndocker run -v /path/on/hostMachine/:/usr/src/ssj/assets/ jerryimmouse/ssj_auth\n```\nThis command will create a symlink to assets folder of the container to `hostMachine` folder\n\nThe full command to run this image can be like this\n```bash\ndocker run \\\n  --name ssj \\\n  -d \\\n  -p 2424:2424 \\\n  -v ./docker-files:/usr/src/ssj/assets \\\n  --env-file .env \\\n  jerryimmouse/ssj_auth\n```\n\n## Deploying\n\u003e [!IMPORTANT]  \n\u003e This app was designed for being behind some reverse proxy like nginx or Apache2. I haven't tested it in other environments.\n\n```shell\ngit clone https://github.com/JerryImMouse/ssj_auth.git\ncd ssj_auth\nnpm install\nmv .env-template .env\nnano .env # make some changes so it would be applicable to you, all fields should be self-explanatory\nnode app.js # probably should setup some daemon for it\n```\n\n## Roadmap\n\n- **Performance Improvements:**\n    - Add indexes to the database to enhance lookup speed.\n    - Optimize the `/api/check` route (considering indexes as a potential solution).\n\n- **Database Support:**\n    - Add support for additional database types.\n\n- **Feature Enhancements:**\n    - Introduce more routes for handling interactions with the Discord API within the game.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerryimmouse%2Fssj_auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerryimmouse%2Fssj_auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerryimmouse%2Fssj_auth/lists"}