{"id":17293284,"url":"https://github.com/brunolemos/micro-oauth","last_synced_at":"2025-08-01T02:07:58.343Z","repository":{"id":80012461,"uuid":"82753647","full_name":"brunolemos/micro-oauth","owner":"brunolemos","description":"🌐 Microservice to add OAuth2 authentication to your application. Supports any provider, like GitHub, Instagram ...","archived":false,"fork":false,"pushed_at":"2018-11-20T07:40:37.000Z","size":54,"stargazers_count":24,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-20T09:51:30.408Z","etag":null,"topics":["micro","microservice","nodejs","oauth","oauth2"],"latest_commit_sha":null,"homepage":"","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/brunolemos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-02-22T02:57:17.000Z","updated_at":"2022-02-04T08:30:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"57d82e4a-7236-4a4e-b165-3c2c920e7355","html_url":"https://github.com/brunolemos/micro-oauth","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/brunolemos/micro-oauth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunolemos%2Fmicro-oauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunolemos%2Fmicro-oauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunolemos%2Fmicro-oauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunolemos%2Fmicro-oauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brunolemos","download_url":"https://codeload.github.com/brunolemos/micro-oauth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunolemos%2Fmicro-oauth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268157898,"owners_count":24204763,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"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":["micro","microservice","nodejs","oauth","oauth2"],"created_at":"2024-10-15T10:47:25.104Z","updated_at":"2025-08-01T02:07:58.291Z","avatar_url":"https://github.com/brunolemos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `micro-oauth`\n\nA tiny microservice that makes it easier to add OAuth authentication to your application.\nThis supports any provider that follows the OAuth2 protocol, like GitHub and Instagram.\n\n## Usage\n\n### Clone this repo\n\nClone the repo:\n\n```sh\ngit clone git@github.com:brunolemos/micro-oauth.git\n```\n\n### Enviroment variables\n\nEdit the `env` field inside `now.json`. Example:\n\n```js\n{\n  // The provider you are authenticating on\n  \"PROVIDER\": \"GitHub\",\n  // or Instagram, ...\n\n  // The provider authorize url (to request permissions from the user)\n  \"AUTHORIZE_URL\": \"https://github.com/login/oauth/authorize\",\n  // or https://www.instagram.com/oauth/authorize, ...\n\n  // The URL to redirect the user to once the authentication was successful\n  // PS: You can also pass this as a ?callback_url parameter on AUTHORIZE_URL env variable above\n  \"CALLBACK_URL\": \"myapp://oauth/github\",\n  // or http://localhost:1234/my/oauth/callback/xxx, ...\n\n  // Your application client id\n  \"CLIENT_ID\": \"abc123\",\n\n  // Your application client secret\n  \"CLIENT_SECRET\": \"abc123\",\n\n  // Provider's url to get the access token\n  \"GET_TOKEN_URL\": \"https://github.com/login/oauth/access_token\"\n  // or https://api.instagram.com/oauth/access_token, ...\n}\n```\n\n\u003e Create an application on the provider website (e.g. [GitHub](https://github.com/settings/applications/new), [Instagram](https://www.instagram.com/developer/clients/register/), ...) to get your `CLIENT_ID` and `CLIENT_SECRET` if you haven't done that already.\n\n### Deploy\n\n```sh\nnow\n```\n\n\n### More details\n\nTo request people authorization, you need to send them to `http://localhost:3000/` or the url generated by `now`.\n\n\u003e You can pass a `?scope=` query param to set the permissions you request from the user, check the provider docs ([GitHub](https://developer.github.com/v3/oauth/#scopes), [Instagram](https://www.instagram.com/developer/authorization/), ...)\n\u003e You can actually pass any other parameter and they will be passed to the callback as well\n\nWhen authentication was successful, the user will be redirected to the `CALLBACK_URL` with the `access_token` query param set to the provider access token. You can then use that token to interact with the Provider API! (see: [GitHub API](https://developer.github.com/v3/), [Instagram API](https://www.instagram.com/developer/endpoints/), ...)\n\n\u003e E.g. setting `CALLBACK_URL=myapp://oauth/github` will redirect them to `myapp://oauth/github/?access_token=abc123`. (where `abc123` is the provided access token)\n\n\u003e If you passed other parameters to AUTHORIZE_URL, e.g. http://xxx.com/?xxx=1, it will be passed to the callback url, e.g. http://callbackurl.com/?access_token=abc123\u0026xxx=1\n\n### Finish setup\n\nTo make this work you have to set the authorization callback URL on the provider website to whatever URL `now` gave you:\n\n![Authorization callback URL: 'https://your-url.now.sh/callback'](https://s19.postimg.org/espmt065v/Screen_Shot_2017_02_28_at_02_57_26.png)\n\nor localhost for testing:\n\n![Authorization callback URL: 'http://localhost:3000/callback'](https://s19.postimg.org/ib1mpe71v/Screen_Shot_2017_02_28_at_02_56_54.png)\n\n### Error handling\n\nIn case an error happens on the server, the user will be redirected to the `CALLBACK_URL` with the `error` query param set to a relevant error message.\n\n## License\n\nCopyright (c) 2018 [Bruno Lemos](https://twitter.com/brunolemos) \u0026 [Maximilian Stoiber](https://twitter.com/mxstbr), licensed under the MIT license.\nSee [LICENSE.md](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunolemos%2Fmicro-oauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunolemos%2Fmicro-oauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunolemos%2Fmicro-oauth/lists"}