{"id":20418506,"url":"https://github.com/willnode/uas-gitlab-auth","last_synced_at":"2025-04-12T17:34:28.508Z","repository":{"id":40617308,"uuid":"126123587","full_name":"willnode/uas-gitlab-auth","owner":"willnode","description":"🔑 Microservice to grant access to GitLab private repo using Asset Store Invoice API.","archived":false,"fork":false,"pushed_at":"2024-05-27T21:50:54.000Z","size":119,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T11:51:15.869Z","etag":null,"topics":["api","gitlab","microservice","nodejs","unity","unity-asset-store","unity3d"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willnode.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}},"created_at":"2018-03-21T04:33:27.000Z","updated_at":"2024-05-27T21:50:57.000Z","dependencies_parsed_at":"2024-11-15T06:33:26.947Z","dependency_job_id":null,"html_url":"https://github.com/willnode/uas-gitlab-auth","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnode%2Fuas-gitlab-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnode%2Fuas-gitlab-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnode%2Fuas-gitlab-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnode%2Fuas-gitlab-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willnode","download_url":"https://codeload.github.com/willnode/uas-gitlab-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248605767,"owners_count":21132228,"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":["api","gitlab","microservice","nodejs","unity","unity-asset-store","unity3d"],"created_at":"2024-11-15T06:33:22.210Z","updated_at":"2025-04-12T17:34:28.489Z","avatar_url":"https://github.com/willnode.png","language":"TypeScript","readme":"# uas-gitlab-auth\n\nThis is a service to grant access to GitLab private repo using Asset Store Invoice API.\n\nThis microservice can handle multiple assets under the same publisher.\n\n[Currently used to serve costumers on my site](https://wellosoft.net/grants/)\n\n## Install\n\n+ Install bun\n+ Write `.env`\n+ `bun start`\n\n## Enviroment Variables\n\n- `UAS_TOKEN` - [Unity Asset Store Verify Invoice Token](https://publisher.assetstore.unity3d.com/verify-invoice.html#apiKeyValue).\n- `GITLAB_TOKEN` - [GitLab Token with API Access](https://gitlab.com/profile/personal_access_tokens).\n- `UAS_ASSETS` - Name of Assets that permitted. Multiple Assets can be separated with comma. Names should match with [names returned from API](http://api.assetstore.unity3d.com/api-docs/#!/invoice).\n- `GITLAB_REPOS` - GitLab repo IDs (number not name) to be granted, in the same order with `UAS_ASSETS`.\n- `ACCESS_ALLOW_ORIGIN` - The URL of your website or `*` if you want to allow any origin (not recommended), for the `Access-Control-Allow-Origin` header.\n\nBelow are optional options to finetune access grants. If you set any non-empty value on these variables, it'll assumed as `true` (default is not set or `false` to prevent abuse and potential pirates):\n\n- `ALLOW_EDIT_AND_DELETE` - Allow user to override or delete if that user has entered Invoices that already exist in the data.\n- `ALLOW_FREE_USERS` - Grant access to users that purchase with zero price (e.g. voucher redeem).\n- `ALLOW_REFUNDED_USERS` - Grant access to users that **has** refunded their purchase.\n\nOther optional nice environment variables:\n\n- `RECAPTCHA_TOKEN` - [Google Recaptcha](https://www.google.com/recaptcha/) secret token if you plan to use recaptcha.\n- `SUCCESS_REDIRECT_TO` - If operation success, redirect user to a specific URL. It'll automatically appended with `?repo=xxx` where `xxx` is repo ID.\n\nBy design it only grant one user per one invoice.\n\n## API\n\nWhen you give GitLab token to this microservice, it will:\n\n+ Grant any registered GitLab user with correct Invoice number as `guest` to the repo.\n+ Autogenerate wiki called `granted_invoices` to save a prettified JSON data about invoice numbers that related to each granted GitLab user.\n\nThis microservice speaks `POST`. If you use `GET` any operation will not modify target repo nor modify grant to user (useful for installation testing).\n\nRequired Request Parameters:\n\n- `invoice`: Invoice number.\n- `username`: GitLab registered Username. If not set or empty and `ALLOW_EDIT_AND_DELETE` is set the operation will delete the invoice number from data and revoking the user access.\n\n## CLient Example\n\nHTML Only:\n\n```html\n\u003cform action=\"https://uas-gitlab-auth-xxxxx.now.sh\" method=\"post\"\u003e\n  Invoice: \u003cinput type=\"text\" name=\"invoice\"\u003e\u003cbr\u003e\n  Username: \u003cinput type=\"text\" name=\"username\"\u003e\u003cbr\u003e\n  \u003cinput type=\"submit\" value=\"Submit\"\u003e\n\u003c/form\u003e\n```\n\nXHR:\n\n```js\nconst invoice='0123', username='smith';\nconst xhr = new XMLHttpRequest();\nxhr.onreadystatechange = function() {\n    if (this.readyState == 4) {\n       console.log(this.status);\n       console.log(xhr.responseText);\n    }\n};\n\nxhr.open('POST', 'https://uas-gitlab-auth-xxxxx.now.sh', true);\nxhr.send(`invoice=${invoice}\u0026username=${username}`);\n```\n\n## Return\n\nThe microservice will respond with human message in the body and either of these codes:\n\n- `200`: Access granted.\n- `202`: Request valid without any modification in repo (e.g. API performed via `GET` or user already been granted)\n- `400`: Wrong or invalid request (e.g. malformed invoice pattern)\n- `403`: Request rejected (e.g. invoice didn't found, repo didn't match, etc.)\n- `500`: Internal error (e.g. token has expired or an issue with the microservice). Check for logs if a user spot this error.\n\n## License\n\n[MIT](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillnode%2Fuas-gitlab-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillnode%2Fuas-gitlab-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillnode%2Fuas-gitlab-auth/lists"}