{"id":18760325,"url":"https://github.com/stefanbohacek/auth-server","last_synced_at":"2025-04-13T03:31:02.441Z","repository":{"id":171975420,"uuid":"616215957","full_name":"stefanbohacek/auth-server","owner":"stefanbohacek","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-19T14:51:54.000Z","size":98,"stargazers_count":15,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T21:06:46.648Z","etag":null,"topics":["authentication","fediverse","miauth","oauth"],"latest_commit_sha":null,"homepage":"https://stefanbohacek.com/blog/making-fediverse-apps-for-everyone/","language":"JavaScript","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/stefanbohacek.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":"2023-03-19T23:32:00.000Z","updated_at":"2025-03-20T22:21:31.000Z","dependencies_parsed_at":"2024-11-07T18:11:32.979Z","dependency_job_id":null,"html_url":"https://github.com/stefanbohacek/auth-server","commit_stats":null,"previous_names":["stefanbohacek/auth-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanbohacek%2Fauth-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanbohacek%2Fauth-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanbohacek%2Fauth-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanbohacek%2Fauth-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanbohacek","download_url":"https://codeload.github.com/stefanbohacek/auth-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248659613,"owners_count":21141147,"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":["authentication","fediverse","miauth","oauth"],"created_at":"2024-11-07T18:11:29.018Z","updated_at":"2025-04-13T03:31:02.163Z","avatar_url":"https://github.com/stefanbohacek.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authentication server\n\nThis project is currently under active development and is intended to be self-hosted.\n\n\u003c!--\nOne option is [importing it to Glitch](https://glitch.com/edit/#!/import/github/stefanbohacek/auth-server). ([Learn more about Glitch.](https://glitch.com/about))\n--\u003e\n\n## How to use\n\nRedirect your user to your authentication server while passing the following variables:\n\n- `method`:\n  - `fediverse`: automatically detect the correct method (oauth or miauth) based on the domain\n  - `oauth`: tested with Mastodon, Friendica, Pleroma, Akkoma, and GoToSocial\n  - `miauth`: tested with Misskey and Calckey/Firefish\n- `instance`: domain name of the server your user needs to authenticate with (eg. mastodon.social)\n- `scope`: required scopes (eg: `scope=read:accounts+read:follows`)\n- `app`: id of your app the user will be redirected to (see `modules/apps.js`)\n\nExample URL:\n\n```\nhttps://authserver.com/?method=fediverse\u0026instance=mastodon.social\u0026scope=read:accounts+read:follows\u0026app=myapp\n```\n\nExample URL for fediverse platforms that support OAuth:\n\n```\nhttps://authserver.com/?method=oauth\u0026instance=mastodon.social\u0026scope=read:accounts+read:follows\u0026app=myapp\n```\n\nExample URL for fediverse platforms that use MiAuth:\n\n```\nhttps://authserver.com/?method=miauth\u0026instance=calckey.social\u0026scope=read:account+read:following\u0026app=myapp\n```\n\nYour users will be redirect to the app's `redirect_url` (from `modules/apps.js`) with the `instance`\n and `token` parameters passed in the URL.\n\n```\nhttps://myapp.com?instance=mastodon.social\u0026token=ABCDE12345\n```\n\nIf you're using the automatic `fediverse` method and an error occurs, the user will be instead redirected to `redirect_url_fail` and an `error` parameter will be passed.\n\nHere's an example for when an instance that uses an unsuported fediverse platform is passed:\n\n```\nhttps://myapp.com?error=platform_not_supported\n```\n## Development\n\n1. Install dependencies with `npm install`.\n2. Rename `.env-copy` to `.env` and update the contents of this file.\n\n```\nENCRYPTION_KEY=\"random text here to be used as your encryption key\"\n```\n\n3. Update `modules/apps.js`.\n\nYou can either redirect the user to your app that requires an authentication token:\n\n```js\n\"my-app-1\": {\n    \"name\": \"This is my app #1\",\n    \"redirect_url\": `https://myapp1.com/?instance=${options.instance}\u0026token=${options.access_token}`\n}\n```\n\nOr you can display the token in the browser for the user to copy:\n\n```js\n\"my-app-2\": {\n    \"name\": \"This is my app #2\",\n    \"showToken\": true\n}\n```\n\n4. Run the authentication server locally:\n\n```sh\nnpm run dev\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanbohacek%2Fauth-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanbohacek%2Fauth-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanbohacek%2Fauth-server/lists"}