Unlocking Sitecore Content Hub: A Guide to Utilizing the Web Client SDK - Part 1
Authentication is handled through the OAuth client, which must be set up in Content Hub and then configured on the client side.
- To create an OAuth client, navigate to the settings and click on OAuth clients.
- Next, click on the " + OAuth Client" icon to create a new OAuth client.
- Develop a fresh console application and incorporate the Web Client SDK NuGet package (Stylelabs.M.Sdk.WebClient).
- Create a new class named MClientConnector and add the ClientId and ClientSecret that were created in the previous steps.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
namespace ContentHubDemo | |
{ | |
internal class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
try | |
{ | |
await MClientConnector.Client.TestConnectionAsync(); | |
Console.WriteLine("Success"); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message); | |
} | |
} | |
} | |
} |
- Now run the console application.
Comments