{"id":23380646,"url":"https://github.com/agility/generateugcaccesshash-netcore","last_synced_at":"2025-04-08T07:43:33.094Z","repository":{"id":97728636,"uuid":"163887872","full_name":"agility/GenerateUGCAccessHash-NetCore","owner":"agility","description":"A utility to initialize the UGC Access Hash on the server, before passing it to the client.","archived":false,"fork":false,"pushed_at":"2019-01-02T21:07:08.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-14T04:51:16.312Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/agility.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}},"created_at":"2019-01-02T20:46:14.000Z","updated_at":"2019-01-02T21:07:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"cd46a6b2-d4ec-4dd4-990b-5332ca34fdd3","html_url":"https://github.com/agility/GenerateUGCAccessHash-NetCore","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/agility%2FGenerateUGCAccessHash-NetCore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agility%2FGenerateUGCAccessHash-NetCore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agility%2FGenerateUGCAccessHash-NetCore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agility%2FGenerateUGCAccessHash-NetCore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agility","download_url":"https://codeload.github.com/agility/GenerateUGCAccessHash-NetCore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247801197,"owners_count":20998331,"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":[],"created_at":"2024-12-21T20:17:30.214Z","updated_at":"2025-04-08T07:43:33.088Z","avatar_url":"https://github.com/agility.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# How to Generate a UGC Access Hash in .NET Core\nIn order to use the Agility UGC API, you need to generate your own Access Key. This should be done on the server for security purposes.\n\nThis repository includes a Utility function to generate your hash, and an HtmlHelper method to output those values server-side as a script and pass the values to use in a client application.\n\n## Setup\n1. Add the UGCUtils class to your project, and ensure you update the namespace appropriately.\n2. Add the HtmlHelpers class to your project, and ensure you update the namespace appropriately.\n3. Use the HtmlHelper in your _Layout.cshtml masterpage to ensure your client app can use these values on each page.\n``` html\n@using Website.Helpers\n...\n\u003cbody\u003e\n    \u003c!-- Inner Template Render: Start --\u003e\n    @RenderBody()\n    \u003c!-- Inner Template Render: End --\u003e\n    \n    \u003c!-- Init UGC Access Hash: Start --\u003e\n    @Html.GetUGCDataServiceInitializationScript()\n    \u003c!-- Init UGC Access Hash: End --\u003e\n\n    \u003c!-- Main JS Bundle: Start --\u003e\n    \u003cscript src=\"~/dist/main.js\" type=\"text/javascript\" asp-append-version=\"true\"\u003e\u003c/script\u003e\n    \u003c!-- Main JS Bundle: End --\u003e\n\n    @RenderSection(\"Scripts\", required: false)\n\u003c/body\u003e\n...\n```\n*Will output:*\n``` html\n\u003cscript\u003e\n    var _AgilityUGCSettings = { \n        'Url': 'https://ugc.agilitycms.com/Agility-UGC-API-JSONP.svc',\n        'AccessKey': '553901D2-F5E1-4BBA-B346-159xxxxxxx', //the website API Access Key provided to you\n        'Seconds': '567353588', //is the number of seconds that have elapsed since Jan 1/2001.\n        'RandomNumber': '205', //just a random number between 1-1000\n        'ProfileRecordID': '-1', //the profile record ID of the logged-in website user, -1 is anonymous\n        'AccessHash': '7c690bdac92defff3a676e24ded04c5xxxxxxx' //The SHA hash of all the above variables\n                                                            //(Seconds.ProfileID.SecretKey.AccessKey.Random)\n    };\n\u003c/script\u003e\n```\n\n## Usage\nAs long as you have the _AgilityUGCSettings js global variable set, you can utilize the Agility UGC API. See the [UGC API](https://github.com/AgilityInc/Agility.UGC.API.js) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagility%2Fgenerateugcaccesshash-netcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagility%2Fgenerateugcaccesshash-netcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagility%2Fgenerateugcaccesshash-netcore/lists"}