{"id":15688338,"url":"https://github.com/ybelenko/oauth2_as_oas3_components","last_synced_at":"2025-05-07T21:23:40.237Z","repository":{"id":57086328,"uuid":"358547893","full_name":"ybelenko/oauth2_as_oas3_components","owner":"ybelenko","description":"OAuth2 definitions as OpenAPI Spec 3.0 components","archived":false,"fork":false,"pushed_at":"2021-04-20T20:48:03.000Z","size":19,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T05:06:46.667Z","etag":null,"topics":["components","oas3","oauth2","openapi"],"latest_commit_sha":null,"homepage":"","language":null,"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/ybelenko.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}},"created_at":"2021-04-16T09:35:37.000Z","updated_at":"2024-04-24T15:16:30.000Z","dependencies_parsed_at":"2022-08-25T00:50:26.146Z","dependency_job_id":null,"html_url":"https://github.com/ybelenko/oauth2_as_oas3_components","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/ybelenko%2Foauth2_as_oas3_components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ybelenko%2Foauth2_as_oas3_components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ybelenko%2Foauth2_as_oas3_components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ybelenko%2Foauth2_as_oas3_components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ybelenko","download_url":"https://codeload.github.com/ybelenko/oauth2_as_oas3_components/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252955282,"owners_count":21831084,"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":["components","oas3","oauth2","openapi"],"created_at":"2024-10-03T17:58:10.210Z","updated_at":"2025-05-07T21:23:40.210Z","avatar_url":"https://github.com/ybelenko.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# OAuth2 as OpenAPI Spec 3.0 components\n\nThe example file which describes OAuth2 token endpoints located [dist/oauth2_endpoints.yml](dist/oauth2_endpoints.yml).\n\n## Why this package exists\nSince [RFC 6749 OAuth2](https://tools.ietf.org/html/rfc6749) server implementation may be very different(optional/recommended response fields, extended grant) it might me useful to describe your unique implementation within your OAS3 file. It's also very handy to see examples of your token and error response, because RFC6749 is a text document without any pictures or graphs. The example file mentioned before contains description of token endpoints for each authorization grant, consider it as starting point.\n\nExample file omits [authorization endpoint](https://tools.ietf.org/html/rfc6749#section-3.1) endpoint on purpose. I don't know how to describe it with OAS3 since endpoint response isn't JSON(html page). If you have any suggestion please submit an issue to this repo.\n\nSince [RFC 6749 - The OAuth2.0 Authorization Framework - 2.3.1. Client Password](https://tools.ietf.org/html/rfc6749#section-2.3.1) doesn't recommend to send client password in request body then our example expects basic authorization in all endpoints.\n\n## Installation\n\n### Copy Paste\nSince it's not actually a code, but markup you can just copy anything you want from [dist/oauth2_endpoints.yml](dist/oauth2_endpoints.yml).\n\nThere is also enhanced example with polymorphism at [dist/oauth2_endpoints_polymorphism.yml](dist/oauth2_endpoints_polymorphism.yml). **Please, make sure that your tools supports polymorphism. This example contains new features not highly adopted yet. Check at least `oneOf` property support. I wouldn't use it myself because most of the OpenAPI tools have issues with polymorphism now, but this example may be useful in forseeable future.**\n\n### Composer\nInstall [Composer - Dependency Manager for PHP](https://getcomposer.org/download/)\n\nThen run in terminal:\n```console\ncomposer require ybelenko/oauth2_as_oas3_components\n```\n\nUse provided components via `$ref` attribute like:\n\n```yaml\npaths:\n  /token:\n    post:\n      summary: Obtain access token with \"authorization_code\" grant.\n      requestBody:\n        $ref: './vendor/ybelenko/oauth2_as_oas3_components/dist/components/requestBodies/TokenRequestCodeGrant.yml'\n      responses:\n        '200':\n          $ref: './vendor/ybelenko/oauth2_as_oas3_components/dist/components/responses/OAuth2TokenSuccessResponse.yml'\n        '4XX':\n          $ref: './vendor/ybelenko/oauth2_as_oas3_components/dist/components/responses/OAuth2TokenErrorResponse.yml'\n```\n\nExtended example with refs [dist/oauth2_endpoints_with_refs.yml](dist/oauth2_endpoints_with_refs.yml)\n\n### NPM\n[Install NPM and Node.js](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)\n\nThen run in terminal:\n```console\nnpm i --save oauth2_as_oas3_components\n```\n\nUse provided components via `$ref` attribute like:\n\n```yaml\npaths:\n  /token:\n    post:\n      summary: Obtain access token with \"authorization_code\" grant.\n      requestBody:\n        $ref: './node_modules/oauth2_as_oas3_components/dist/components/requestBodies/TokenRequestCodeGrant.yml'\n      responses:\n        '200':\n          $ref: './node_modules/oauth2_as_oas3_components/dist/components/responses/OAuth2TokenSuccessResponse.yml'\n        '4XX':\n          $ref: './node_modules/oauth2_as_oas3_components/dist/components/responses/OAuth2TokenErrorResponse.yml'\n```\n\nExtended example with refs [dist/oauth2_endpoints_with_refs.yml](dist/oauth2_endpoints_with_refs.yml)\n\n## Contributing\n\nIf you have any suggestions please submit an issue.\n\n## License\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fybelenko%2Foauth2_as_oas3_components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fybelenko%2Foauth2_as_oas3_components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fybelenko%2Foauth2_as_oas3_components/lists"}