{"id":16796080,"url":"https://github.com/esemesek/spring-oauth2-example","last_synced_at":"2026-04-30T11:35:00.424Z","repository":{"id":185062250,"uuid":"95285549","full_name":"Esemesek/spring-oauth2-example","owner":"Esemesek","description":"Spring oauth2 example","archived":false,"fork":false,"pushed_at":"2017-06-24T10:15:20.000Z","size":60,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-08T06:03:08.382Z","etag":null,"topics":["gradle","java","java-8","oauth2","spring","spring-boot","spring-security","springboot","springframework"],"latest_commit_sha":null,"homepage":"","language":"Java","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/Esemesek.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}},"created_at":"2017-06-24T08:32:00.000Z","updated_at":"2017-07-24T06:12:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"d7da6863-1e71-45a1-96dc-eee2958c3bff","html_url":"https://github.com/Esemesek/spring-oauth2-example","commit_stats":null,"previous_names":["esemesek/spring-oauth2-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Esemesek/spring-oauth2-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Esemesek%2Fspring-oauth2-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Esemesek%2Fspring-oauth2-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Esemesek%2Fspring-oauth2-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Esemesek%2Fspring-oauth2-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Esemesek","download_url":"https://codeload.github.com/Esemesek/spring-oauth2-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Esemesek%2Fspring-oauth2-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32463892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"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":["gradle","java","java-8","oauth2","spring","spring-boot","spring-security","springboot","springframework"],"created_at":"2024-10-13T09:18:13.640Z","updated_at":"2026-04-30T11:34:55.401Z","avatar_url":"https://github.com/Esemesek.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is this?\nSample SpringBoot application with OAuth2 based authorization.\n\n# How to use?\n#### Boot run application\n```bash\n./gradlew clean bootRun\n```\n\n#### Get access token with password\n```bash\ncurl -XPOST -vu app:secret \"http://localhost:9000/server/oauth/token?username=admin\u0026password=admin\u0026grant_type=password\"\n```\n\nResponse:\n\n```bash\n{\n    \"access_token\":\"aa1dbe69-b03a-4517-966f-a9bd5e0e4747\",\n    \"token_type\":\"bearer\",\n    \"refresh_token\":\"89472ee5-01b1-400b-8fcf-413cf52df7f4\",\n    \"expires_in\":1799,\n    \"scope\":\"read write\"\n}\n```\n\n#### Get access token with refresh token\n```bash\ncurl -XPOST -vu app:secret \"http://localhost:9000/server/oauth/token?refresh_token=89472ee5-01b1-400b-8fcf-413cf52df7f4\u0026grant_type=refresh_token\"\n```\n\nResponse:\n\n```bash\n{\n    \"access_token\":\"262f25ab-943e-4014-b254-542acc808d22\",\n    \"token_type\":\"bearer\",\n    \"refresh_token\":\"89472ee5-01b1-400b-8fcf-413cf52df7f4\",\n    \"expires_in\":1799,\n    \"scope\":\"read write\"\n}\n```\n\n#### Access unsecured resources\n```bash\ncurl -XGET http://localhost:9000/server/unsecured\n```\n\nResponse:\n\n```bash\nJust public stuff\n```\n\n#### Access secured resources\n```bash\ncurl -XGET http://localhost:9000/server/secured\n```\n\nResponse:\n\n```bash\n{\n    \"timestamp\":1498298747485,\n    \"status\":401,\n    \"error\":\"Unauthorized\",\n    \"message\":\"Access Denied\",\n    \"path\":\"/server/secured\"\n}\n```\n\nGet access_token\n\n```bash\ncurl -XPOST -vu app:secret \"http://localhost:9000/server/oauth/token?username=admin\u0026password=admin\u0026grant_type=password\"\n```\n\nResponse:\n\n```bash\n{\n    \"access_token\":\"2782cbd7-852c-41f1-9477-7e2a78e6fe38\",\n    \"token_type\":\"bearer\",\n    \"refresh_token\":\"89f7bf5a-720b-42e8-8b47-a80222a4fbdd\",\n    \"expires_in\":1799,\n    \"scope\":\"read write\"\n}\n```\n\nRequest resource with Authorization header\n\n```bash\ncurl -XGET -H \"Authorization: Bearer 2782cbd7-852c-41f1-9477-7e2a78e6fe38\" http://localhost:9000/server/secured\n```\n\nResponse:\n\n```bash\nSecret stuff\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesemesek%2Fspring-oauth2-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesemesek%2Fspring-oauth2-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesemesek%2Fspring-oauth2-example/lists"}