Welcome to our Machine to Machine Authorization service. This guide will walk you through the process of obtaining your credentials and integrating our authentication API into your .NET Core application.

Step 1: Obtain Your Credentials

To access our API, you need to secure a client_id and client_secret. These credentials are essential for the secure communication between our service and your application.

How to Obtain Credentials:

  1. Log into your merchant dashboard on our website.
  2. Go to the Developers -> API Credentialssection.
  3. Copy your client_id and client_secret from this section. You will use these credentials to authenticate your API requests.

Step 2: Integrating the API

You can integrate our API into various programming environments. The integration primarily involves making a POST request to our authentication endpoint with your credentials. Below, we provide an example using .NET Core, but the principles are applicable across different programming languages and frameworks.

.NET Core Example

This example demonstrates how to make a POST request to our authorization API using C# in a .NET Core application. Ensure you have a .NET Core environment set up and the necessary NuGet packages installed for HTTP operations.

Code Snippet:

using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace YourNamespace
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var client = new HttpClient();

            var postData = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair<string, string>("grant_type", "client_credentials"),
                new KeyValuePair<string, string>("client_id", "your_client_id"), // Replace with your client_id
                new KeyValuePair<string, string>("client_secret", "your_client_secret") // Replace with your client_secret
            });

            try
            {
                var response = await client.PostAsync("https://sso.omno.com/realms/omno/protocol/openid-connect/token", postData);
                if (response.IsSuccessStatusCode)
                {
                    var content = await response.Content.ReadAsStringAsync();
                    Console.WriteLine("API Response: " + content);
                }
                else
                {
                    Console.WriteLine("API Error: " + response.StatusCode);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception occurred: " + ex.Message);
            }
        }
    }
}

Replace "your_client_id" and "your_client_secret" with the credentials you obtained from the merchant dashboard.

Security and Best Practices

  • Never expose your client_id and client_secret in your source code, especially in public repositories.
  • Consider using environment variables or secure app settings to store sensitive data.
  • Regularly review and update your security practices in line with industry standards.

Next Steps

After implementing the basic request, you might want to explore the functionalities of our API further. Consult our detailed API documentation for information on additional features and endpoints.