[]
        
(Showing Draft Content)

Authentication

Before making any web API calls to the ADO.NET Provider for Magento, it is essential to authenticate your identity and obtain the necessary permissions, also known as authorization, to access the API resource securely. This process ensures that Magento can identify the type of user making the call and grant appropriate access rights to the API resource.

Basic Authentication

  • UserName - Set this to your user name in Magento Portal.

  • Password - Set this to your password in Magento Portal.

  • TokenType - Can be set as one of the following:

    • Admin - The merchant will determine the Magento resources that an admin user can access.
    • Customer - Resources with anonymous or self permission are accessible. These settings cannot be edited by Merchants.

Connection string with basic

const string Url = @"http://*.*.***";
const string Username = @"****";
const string Password = @"****";
const string TokenType = @"*****";
static string MagentoConnectionString = $@”Url={Url};UserName={Username};Password={Password};Token Type={TokenType}“;

OAuth 1.0 authentication

Property Description
URL Set the URL to the HTTP or HTTPS endpoint of your Magento Portal. For example, https://magentohost/.
Consumer Key A value used by the Consumer to identify itself in OAuth 1.0.
Consumer Secret A secret used by the Consumer to establish ownership of the Consumer Key.
Access Token The OAuth 1.0 access token is to be used for the authentication.
Token Secret A secret used by the Consumer to establish ownership of the given Token.
Verifier The verification code is given by the provider.

To generate OAuth 1.0 components, Log in to the Magento Admin Panel -> System -> Integrations -> Add New Integration.

Connection string with OAuth 1.0

const string Url = @"http://*.*.***";
const string ConsumerKey = @"***********";
const string ConsumerSecret = @"***********";
const string Verifier = @"******************";
string MagentoConnection = $"Url={Url};Consumer Key={ConsumerKey};Consumer Secret={ConsumerSecret};Verifier={Verifier};

Connection string with tokens

If the user already possesses the Access Token and Token Secret, doesn't have to re-obtain them, but can use them to connect directly, like in the code below:

const string Url = @"http://*.*.***";
const string ConsumerKey = @"***********";
const string ConsumerSecret = @"***********";
const string Verifier = @"******************";
const string AccessToken = @"*********************";
const string TokenSecret = @"*********************";
string MagentoConnection = $"Url={Url};Consumer Key={ConsumerKey};Consumer Secret={ConsumerSecret};Verifier={Verifier};Access Token={AccessToken};Token Secret={TokenSecret}"

Supported Authentication methods for Magento provider

Magento provider supports two authentication methods: Basic Authentication and OAuth1 Authentication.

  • For Basic Authentication in Magento, you can authenticate by providing a username, password, and token type, either "Admin" or "Customer." This method is straightforward and commonly used for authenticating requests to the Magento server. Provide the username and password associated with your Magento account, along with the desired token type. Additionally, specify the Magento server URL to direct your requests to the correct endpoint.
  • OAuth1 Authentication requires a more intricate setup compared to Basic Authentication. To authenticate using OAuth1, provide a consumer key, consumer secret, verifier, and the Magento server URL. Start by registering your application with Magento to obtain the consumer key and consumer secret. During the authentication process, your application will receive a verifier necessary to finalize the authentication flow. This method offers a secure way to authenticate requests to the Magento server while adhering to OAuth1 standards. By following these steps and providing the required credentials, you can authenticate your application with Magento securely and access resources via API calls.

Connection properties used on each type of authentication

Basic Authentication

  1. Username: Specifies the username for authentication.
  2. Password: Specifies the password for authentication.
  3. TokenType: Specifies the type of token service for authentication. It can be either "Admin" or "Customer".
  4. Url: Specifies the Magento server URL.

OAuth1 Authentication

  1. ConsumerKey: Specifies the OAuth consumer key for authentication.
  2. ConsumerSecret: Specifies the OAuth consumer secret for authentication.
  3. Verifier: Specifies the OAuth verifier for authentication.
  4. Url: Specifies the Magento server URL.