{"id":16883171,"url":"https://github.com/wilsonwu/netcoreauth","last_synced_at":"2025-10-23T19:56:32.188Z","repository":{"id":151601655,"uuid":"92899504","full_name":"wilsonwu/netcoreauth","owner":"wilsonwu","description":"ASP.NET Core with JWT Authentication Demo","archived":false,"fork":false,"pushed_at":"2019-02-14T07:43:29.000Z","size":34,"stargazers_count":23,"open_issues_count":2,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-16T05:45:45.150Z","etag":null,"topics":["api","asp-net-core","azure-sql-database","demo","dotnet-core","jwt","oauth2","rest-api","swagger"],"latest_commit_sha":null,"homepage":null,"language":"C#","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/wilsonwu.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-05-31T03:16:22.000Z","updated_at":"2025-01-07T15:25:53.000Z","dependencies_parsed_at":"2023-05-03T15:02:45.311Z","dependency_job_id":null,"html_url":"https://github.com/wilsonwu/netcoreauth","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wilsonwu/netcoreauth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonwu%2Fnetcoreauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonwu%2Fnetcoreauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonwu%2Fnetcoreauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonwu%2Fnetcoreauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilsonwu","download_url":"https://codeload.github.com/wilsonwu/netcoreauth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonwu%2Fnetcoreauth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280684004,"owners_count":26372970,"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-10-23T02:00:06.710Z","response_time":142,"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":["api","asp-net-core","azure-sql-database","demo","dotnet-core","jwt","oauth2","rest-api","swagger"],"created_at":"2024-10-13T16:10:39.082Z","updated_at":"2025-10-23T19:56:32.156Z","avatar_url":"https://github.com/wilsonwu.png","language":"C#","readme":"# netcoreauth\nASP.NET Core with JWT Authentication Demo\n\n# Framework and SDK\n- Compatibile for `Visual Studio 2017` and `Visual Studio for Mac`\n- Base on `.NET Core 2.0`\n- `Swashbuckle.AspNetCore` for Swagger API documentation\n- `Dapper` for ORM\n- `MailKit` for email sending\n- `Azure SQL Database` (SQL Server standalone also fine)\n\n# Token Policy\n- **Access Token**: JWT token genrate by `POST: /api/tokens/access` the Sign In API, can be refreshed, the access token has not been stored\n- **Refresh Token**: JWT token genrate by `POST: /api/tokens/access` the Sign In API, will be replaced by new one if call refresh API, the refresh token has not been stored\n- **Active Token**: JWT token genrate by `POST: /api/users` the Create Account API and `GET: /api/users/sendactiveemail/{email}` the Send Account Activation Mail API, use for active account, it has been stored in Token table till finish account activation \n- **Rest Password Token**: JWT token genrate by `GET: /api/users/sendresetmail/{email}` the Send Reset Password Mail API, use for reset account password, it has been stored in Token table till finish password update. \n\n# Steps to Run:\n1. Create your database manually and run the user and token tables create script under `netcoreauth.model` project `Scripts` folder.\n2. Update database connection string in `appsettings.json`\n3. If you want to use mail sending for account activation, please update the `Mail.cs` class file in `netcoreauth.model` project, suggest to use Gmail, I tested by Gmail successful in my project. \n4. After all, try `http://[localhost]:[port]/swagger`, to get API document\n5. `GET: /api/tests/1` this API without Auth, `GET: /api/tests` this API with Auth\n6. Call `POST: /api/users` to create account\n7. Get the token in you database token table, then call `PUT: /api/users/active/{token}` to active account\n8. Call `POST: /api/tokens/access` to use your email and password login and get tokens (access token and refresh token)\n    ```\n    POST /api/tokens/access\n    {\n      \"email\": \"xxxx@xxxx.com\",\n      \"password\": \"xxxxxxxxxxxxxxxxxxxxxxx\"\n    }\n    ```\n9. Call `GET: /api/tests` with header: `Authorization: Bearer {token}`, both access token and refresh token work fine\n    ```\n    GET /api/tests\n    Authorization: Bearer xxxxxxxxxxx\n    ```\n10. Get response: `[\"value1\", \"value2\"]` without `401` HTTP code from `GET: /api/tests`, that means you get success.\n\n# TODO\n1. ~~Database script add~~\n2. ~~More detail usage description for this demo~~\n3. Send mail async implementation\n4. Add Postman script samples for API calls\n5. ~~Upgrade to .NET Core 2.0~~\n6. Add API version support\n","funding_links":[],"categories":["C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonwu%2Fnetcoreauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilsonwu%2Fnetcoreauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonwu%2Fnetcoreauth/lists"}