{"id":27599630,"url":"https://github.com/clerk/asp-mvc-example","last_synced_at":"2026-05-28T00:33:10.963Z","repository":{"id":288348705,"uuid":"966851504","full_name":"clerk/asp-mvc-example","owner":"clerk","description":"Clerk ASP.net MVC Example","archived":false,"fork":false,"pushed_at":"2025-04-15T14:49:45.000Z","size":4106,"stargazers_count":0,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-29T06:56:14.839Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clerk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-04-15T14:49:00.000Z","updated_at":"2025-09-11T03:34:21.000Z","dependencies_parsed_at":"2025-04-22T15:41:59.467Z","dependency_job_id":null,"html_url":"https://github.com/clerk/asp-mvc-example","commit_stats":null,"previous_names":["clerk/asp-mvc-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/clerk/asp-mvc-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clerk%2Fasp-mvc-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clerk%2Fasp-mvc-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clerk%2Fasp-mvc-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clerk%2Fasp-mvc-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clerk","download_url":"https://codeload.github.com/clerk/asp-mvc-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clerk%2Fasp-mvc-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33589683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"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":[],"created_at":"2025-04-22T15:39:50.625Z","updated_at":"2026-05-28T00:33:10.950Z","avatar_url":"https://github.com/clerk.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clerk ASP.net MVC Example \n\nA demonstration of using Clerk JWT authentication with ASP.net MVC. This example shows how to integrate Clerk's user authentication with a ASP.net MCV backend API.\n\n## Configuration\n\n```bash\n$ export CLERK_API_SECRET_KEY=your_secret_key\n\n# Set authorized parties (comma-separated list of allowed origins)\n$ export CLERK_AUTHORIZED_PARTIES=http://localhost:5173\n```\n\n## Installation\n\n```bash\n$ dotnet install\n```\n\n\n## Running\n\nRun the server:\n```bash\n$ dotnet Run\n```\n\nThe server will be running at `http://localhost:5063`.\n\n## Frontend Integration\n\nFrom a Clerk React frontend:\n\n```js\nimport { useAuth } from '@clerk/clerk-react';\n\nfunction ApiExample() {\n  const { getToken } = useAuth();\n  \n  const fetchData = async () =\u003e {\n    if (getToken) {\n      // Get the userId or null if the token is invalid\n      let res = await fetch(\"http://localhost:5063/Home/ClerkJWTS\", {\n          headers: {\n              \"Authorization\": `Bearer ${await getToken()}`\n          }\n      });\n      console.log(await res.json()); // {userId: 'the_user_id_or_null'}\n\n      // Get gated data or a 401 Unauthorized if the token is not valid\n      res = await fetch(\"http://localhost:5063/Home/GatedData\", {\n          headers: {\n              \"Authorization\": `Bearer ${await getToken()}`\n          }\n      });\n      if (res.ok) {\n          console.log(await res.json()); // {foo: \"bar\"}\n      } else {\n          // Token was invalid\n      }\n    }\n  };\n  \n  return \u003cbutton onClick={fetchData}\u003eFetch Data\u003c/button\u003e;\n}\n```\n\n## API Reference\n\nAvailable endpoints:\n\n    GET /Home/ClerkJWTS - Returns the authenticated user ID\n    GET /Home/GatedData - Returns protected data (requires authentication)\n\n## ⚠️ Production Warning\n\nThis project is not optimized for production and does not address all best practices that should be configured in a production app. It serves as a design template and should be given appropriate consideration before being used in production.\n\nIssues to address for production use:\n- CORS configuration is specific to development environments\n- No HTTPS enforcement\n- Minimal error handling (especially 401 errors)\n- Using development server settings\n\nFor production deployment:\n1. Configure proper CORS settings for your specific domains\n2. Enforce HTTPS for all API communication\n3. Implement comprehensive error handling\n4. Use a production-grade web server instead of the built-in development server","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclerk%2Fasp-mvc-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclerk%2Fasp-mvc-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclerk%2Fasp-mvc-example/lists"}