DataConnector | ComponentOne
ADO.NET provider for Magento / Authentication
In This Topic
    Authentication
    In This Topic

    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

    Connection string with basic

    C#
    Copy Code
        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

    C#
    Copy Code
        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:

    C#
    Copy Code
    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.

    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.