{"id":21900970,"url":"https://github.com/citrix/citrix-unified-workspace-api-web-example","last_synced_at":"2025-10-06T00:56:23.000Z","repository":{"id":201017089,"uuid":"681259886","full_name":"citrix/citrix-unified-workspace-api-web-example","owner":"citrix","description":"Sample web application for the Citrix(R) Unified Workspace API","archived":false,"fork":false,"pushed_at":"2025-08-04T15:03:46.000Z","size":4800,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-04T18:28:48.281Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://developer-docs.citrix.com/en-us/workspace-platform/unified-workspace-api-preview/overview","language":"JavaScript","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/citrix.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-21T16:08:37.000Z","updated_at":"2024-05-09T16:13:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"75ddd119-9cac-4403-ad5c-5e875e1d01c3","html_url":"https://github.com/citrix/citrix-unified-workspace-api-web-example","commit_stats":null,"previous_names":["citrix/citrix-unified-workspace-api-web-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/citrix/citrix-unified-workspace-api-web-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citrix%2Fcitrix-unified-workspace-api-web-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citrix%2Fcitrix-unified-workspace-api-web-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citrix%2Fcitrix-unified-workspace-api-web-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citrix%2Fcitrix-unified-workspace-api-web-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/citrix","download_url":"https://codeload.github.com/citrix/citrix-unified-workspace-api-web-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citrix%2Fcitrix-unified-workspace-api-web-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278542675,"owners_count":26004061,"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-05T02:00:06.059Z","response_time":54,"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":"2024-11-28T15:11:44.055Z","updated_at":"2025-10-06T00:56:22.994Z","avatar_url":"https://github.com/citrix.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Citrix(R) Unified Workspace API - Web Client sample built with .Net Core\n\nThis sample is a small web application, built on .NET Core, that shows how to interact with the Citrix(R) Unified Workspace APIs. This is intended to demonstrate the APIs if you would like to use some of this functionality into your own applications/web sites.\n\nThe application is a web-based client that allows the user to login via the Citrix Authorization server (and your configured Identity Provider), obtain an OAuth Access and Refresh Token, and call the Workspace APIs.\n\nThis is purely an example and shouldn't be used for real production services. The entire end-to-end flow is contained within a single application including storing the Client details.\n\n## Sample site preview\n\n![Homepage](./screenshots/Resources.PNG)\n\n## Prerequisites\n\n- You have either a Private or Public Workspace OAuth Client\n- You will be running the example code in Visual Studio and can run [.NET 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)\n- You have the [Citrix Workspace App](https://www.citrix.com/downloads/workspace-app/windows/workspace-app-for-windows-latest.html) installed\n\n## Getting Started\n\n### Https Self-Signed Certificate\n\nYou need to have an have a local self-signed developer certificate created and trusted. If you are using Visual Studio this should be taken care for you. See the `dotnet dev-certs` command, https://learn.microsoft.com/en-us/dotnet/core/additional-tools/self-signed-certificates-guide.\n\n### Configuration\n\nFor this to work out of the box, your Workspace OAuth Client will need to have `https://localhost:7182/callback` added as an allowed redirect URL.\n\n#### Workspace OAuth Client Settings\n\nTo configure the Workspace OAuth Client settings - including secrets - use the dotnet user secrets feature. See https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-6.0\u0026tabs=windows.\n\nThese settings will be related to OAuth clients created in the Citrix Cloud Admin Console - see [the documentation](https://developer-docs.citrix.com/en-us/workspace-platform/unified-workspace-api-preview/oauth-client-management) for details on how to create one.\n\nExample:\n```json\n{\n  \"Client\": {\n    \"ClientId\": \"clientId==\",\n    \"ClientSecret\": null,\n    \"ApplicationId\": null,\n    \"CallbackPath\": \"/callback\",\n    \"UsePkce\": true,\n    \"UseOfflineAccess\": true\n  }\n}\n```\n\n- [Required] `ClientId`: The Client ID of the client. \n- [Required] `ApplicationId`: The Application ID of the client.\n- [Optional] `ClientSecret`: The Client Secret of the client, shown after creating a private client. This is only needed if a private client was created.\n- [Optional] `CallbackPath`: Set to `/callback` by default, this is used to formulate the 'redirect url' that is required to be set on the client, e.g. the host for this application is `https://localhost:7182` and therefore the allowed redirect URL set on the client must be `https://localhost:7182/callback`.\n- [Optional] `UsePkce`: Set to true by default, this must match what you set during client creation. You can check the value by clicking the \"Edit\" dropdown item for the client you want to use\n- [Optional] `UseOfflineAccess`: Set to true by default, this must match what you set during client creation. You can check the value by clicking the \"Edit\" dropdown item for the client you want to use\n\n## Running the example\n\n- Recommend using an Incognito browser to avoid cookie and cache causing problems.\n\nOnce started, you should be directed to the login page:\n\n![Login Screen](./screenshots/Login.PNG)\n\nAt this point, enter your customer.cloud.com address and hit 'login'.\n\nIt should direct you to the standard login flow and after entering your login details it will take you to the home page:\n\n![Homepage](./screenshots/Resources.PNG)\n\nClicking on the resources should initiate a launch:\n\n![Start Launch](./screenshots/Launch_Initial.PNG)\n\n![CWA Launch](./screenshots/CWA_Opening_App.PNG)\n\n![Launch success](./screenshots/Calculator_Launched.PNG)\n\nYou can view the Token information by going to the `/RefreshToken` endpoint:\n\n![Refresh](./screenshots/RefreshToken.PNG)\n\n## Resource launches\n\nThis example supports three types of launch, native, HTML5, and IFrame.\n\nYou can switch between the launch types using the dropdown:\n\n![Launch Types dropdown](./screenshots/launch_types_dropdown.PNG)\n\n### Native (Receiver) launches\n\nNative launches work by calling the native receiver with a launch ticket that can obtained from the `launchstatus` endpoint on a resource. This response contains the URL to redirect the user to.\n\n### HTML5 and IFrame launches\n\nHTML5 and IFrame launches work similarly to each other. These launch methods make use of the Citrix HTML5 HDX SDK. This SDK uses the ICA file which contains information about how a connection should be established. An ICA file can be obtained from the `launchica` endpoint on a resource.\n\n![HTML Launch Flow](./sequence/html5-launch-flow.png)\n\nSource code to launch a resource in a new tab. For more information check the [SDK documentation](https://developer-docs.citrix.com/en-us/citrix-workspace-app-for-html5/workspace-app-html5-hdx-sdx/hdx-sdk-html5)\n\n```js\ncitrix.receiver.setPath(\"https://localhost:7182/receiver\"); \nlet icaFile = await apiHandler.get(launchUrl)\nconst sessionId = \"html5\"\nconst connectionParams = {\n    \"launchType\": \"newtab\",\n    \"container\": {\n        \"type\": \"window\"\n    }\n};\n\nfunction sessionCreated(sessionObject){\n    const launchData = {\"type\": \"ini\", value: icaFile.data};\n    sessionObject.start(launchData);\n}\ncitrix.receiver.createSession(sessionId, connectionParams,sessionCreated);\n```\n\n## What could go wrong\n\nIf you are presented with this page:\n![Error](./screenshots/Error.PNG)\n\nit's likely that you've mis-configured your client. Please confirm the redirect URLs setup for the client and ensure it includes `https://localhost:7182/callback`, or something else if you've modified the launch settings.\n\nIf that doesn't seem to be the issue, please contact Support.\n\n## Javascript Libraries\n\nThe repo includes the following javascript libraries,\n\n- Bootstrap, https://getbootstrap.com/\n- jQuery,  https://jquery.com/\n\n## License\n\nCopyright © 2025. Cloud Software Group, Inc. All Rights Reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitrix%2Fcitrix-unified-workspace-api-web-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcitrix%2Fcitrix-unified-workspace-api-web-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitrix%2Fcitrix-unified-workspace-api-web-example/lists"}