Magento 2 Oauth Authentication
OAUTH BASED AUTHENTICATION
Full doc details available here - https://devdocs.magento.com/guides/v2.4/get-started/authentication/gs-authentication-oauth.html The full Oauth flows is described here Magento 2 Token Based Authentication however for JLR we will have very simple way of using the Oauth because they have generated the tokens which we just need to hardcore and use when making requests.
The Oauth1.0 is used for the authentication and we have to include in the header:
Field | Value | Comment |
---|---|---|
Signature Method | HMAC-SHA256 | |
Consumer Key | fhe08tiqrnpuwu9jdc18dexgsb2i8tth | Hardcoded in Hemi |
Consumer Secret | mtslsnlyuik90hfz5c9f6u9mox603wvn | Hardcoded in Hemi |
Access Token | zcndmc1ncig9agpu46nf7sbt5j42rtfm | Hardcoded in Hemi |
Token Secret | nx9m8aupu8h20t289sp2f5qknez8tto4 | Hardcoded in Hemi |
Timestamp | 16460548891 | Automatically generated using the current time in Unix |
Nonce | Hemi16460548812 | Random generated string which must be different every request. |
Version | 1.0 | Hardcoded as 1.0 |
The new fields will be stored in Hemi in Magento 2 Connector table. There we want to have a radio button which allows us to decide what type of Authorization we would like to have for the connector for example “Token Based” or “Oauth Based”. Based on the selection the relevant fields will be displayed.
If we select “Token Based” we wand to see the “Username“ and “Password“

If we select “Oauth Based“ we would like to see the “Consumer Key“, “Consumer Secret“, “Access Token“ and “Token Secret“

By default we would like to be preselected the “Token Based” radio button