{"id":20215640,"url":"https://github.com/casdoor/casdoor-cpp-sdk","last_synced_at":"2025-10-24T14:46:13.635Z","repository":{"id":104353597,"uuid":"504770256","full_name":"casdoor/casdoor-cpp-sdk","owner":"casdoor","description":"C++ client SDK for Casdoor","archived":false,"fork":false,"pushed_at":"2023-08-12T18:43:04.000Z","size":140,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T13:11:12.229Z","etag":null,"topics":["auth","authentication","authn","c","casdoor","cpp","iam","oauth","oidc","sdk","sso"],"latest_commit_sha":null,"homepage":"https://github.com/casdoor/casdoor","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casdoor.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,"roadmap":null,"authors":null}},"created_at":"2022-06-18T07:02:29.000Z","updated_at":"2024-08-13T15:52:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"fff38d47-44a9-47f4-8082-a9ccecb94dd3","html_url":"https://github.com/casdoor/casdoor-cpp-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-cpp-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-cpp-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-cpp-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casdoor%2Fcasdoor-cpp-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casdoor","download_url":"https://codeload.github.com/casdoor/casdoor-cpp-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248233989,"owners_count":21069493,"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":["auth","authentication","authn","c","casdoor","cpp","iam","oauth","oidc","sdk","sso"],"created_at":"2024-11-14T06:23:45.267Z","updated_at":"2025-10-24T14:46:08.593Z","avatar_url":"https://github.com/casdoor.png","language":"C++","readme":"# casdoor-cpp-sdk\n\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord\u0026label=discord\u0026color=5865F2)](https://discord.gg/5rPsrAzK7S)\n\nThis is Casdoor's SDK for C++, which will allow you to easily connect your application to the Casdoor authentication system without having to implement it from scratch.\n\nCasdoor SDK is very simple to use. We will show you the steps below.\n\n## Step1. Init SDK\n\nInitialization requires 5 parameters, which are all string type:\n\n| Name (in order) | Must | Description                                         |\n| --------------- | ---- | --------------------------------------------------- |\n| endpoint        | Yes  | Casdoor Server Url, such as `http://localhost:8000` |\n| client_id        | Yes  | Client ID for the Casdoor application               |\n| client_secret    | Yes  | Client secret for the Casdoor application           |\n| certificate     | Yes  | x509 certificate content of Application.cert        |\n| org_name         | Yes  | The name for the Casdoor organization               |\n\u003c!-- | appName         | No   | The name for the Casdoor application                | --\u003e\n\n```cpp\nCasdoorConfig casdoorConfig = new CasdoorConfig(endpoint, client_id, client_secret, certificate, org_name);\n\n```\n\n## Step2. Get token and parse\n\nAfter Casdoor verification passed, it will be redirected to your application with code and state, like https://forum.casbin.com/callback?code=xxx\u0026state=yyyy.\n\nYour web application can get the `cod`e and call `GetOAuthToken(code=code)`, then parse out jwt token.\n\n```cpp\nstring access_token = casdoorConfig.GetOAuthToken(code)\nstrin user_json = casdoorConfig.ParseJwtToken(access_token)\n```\n`user_json` is the JSON data decoded from the access_token, which contains user info and other useful stuff.\n\n## Step3. Interact with the users\n\nIn casdoor-cpp-sdk, `CasdoorConfig`  support basic user operations, like:\n* `GetUsers()` : Get all users.\n* `GetUser(string user_id)`: get single user by user name.\n* `ModifyUser(string method, CasdoorUser user)/AddUser(string method, CasdoorUser user)/UpdateUser(string method, CasdoorUser user)/DeleteUser(string method, CasdoorUser user)` : modify user entry in database.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasdoor%2Fcasdoor-cpp-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasdoor%2Fcasdoor-cpp-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasdoor%2Fcasdoor-cpp-sdk/lists"}