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
anonymous
or self
permission are accessible. These settings cannot be edited by Merchants. 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}“; |
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.
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}; |
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}" |
Magento provider supports two authentication methods: Basic Authentication and OAuth1 Authentication.