cancel
Showing results for 
Search instead for 
Did you mean: 

Web API Security in Magento 2.4.5 (Adobe Commerce)

Web API Security in Magento 2.4.5 (Adobe Commerce)

Hello here,

Please explain how the following two web api security options work: 

  • Allow anonymous guest access global
  • Allow OAuth Access Tokens to be used as standalone Bearer Tokens store view.

Which one to use to have full access to the application through the API?

Does anyone have a demo site so I can try out these configurations?

 

Thanks in adv.

1 REPLY 1

Re: Web API Security in Magento 2.4.5 (Adobe Commerce)

Hello @developmen78d2 

1) Allow anonymous guest access global

  •  In Magento 2, the "Allow Anonymous Guest Access" global web API security option controls   

whether or not users who are not logged in to the Magento store can access the store's web APIs.
If this option is set to "Yes", then users who are not logged in will be able to access the web APIs that have been configured to allow anonymous access. This can be useful for allowing certain types of data to be accessed without requiring users to log in, such as product catalog data or order tracking information.

On the other hand, if this option is set to "No", then anonymous users will not be able to access any of the store's web APIs, and will be required to log in first. This can provide an additional layer of security, as it ensures that only authorized users are able to access the store's data via the web APIs.
It's important to note that even if the "Allow Anonymous Guest Access" option is set to "Yes", individual web API resources can still be configured to require authentication. This allows store owners to have fine-grained control over which parts of their store's data can be accessed anonymously, and which require authentication.
Overall, the "Allow Anonymous Guest Access" global web API security option in Magento 2 is an important setting that can help store owners balance the need for accessibility with the need for security, and ensure that their store's data is being accessed only by authorized users.

2) Allow OAuth Access Tokens to be used as standalone Bearer Tokens store view.

  • In Magento 2, OAuth is a standard protocol used for authentication and authorization. It enables secure access to Magento 2 resources by creating access tokens that allow a third-party application or client to access the resources on behalf of a user without disclosing the user's credentials.

By default, Magento 2 generates OAuth access tokens that are associated with a specific customer account and are only valid for a specific period of time. These access tokens are used to access resources such as customer information, orders, and product data.


However, in some cases, it may be necessary to use these OAuth access tokens as standalone bearer tokens, independent of any specific customer account. This can be useful in cases where the resource being accessed is not specific to a particular customer account, such as static content or catalog data that is publicly available.

To allow OAuth access tokens to be used as standalone bearer tokens, you can configure this option in the Magento 2 admin panel under the "Stores" section. In the "Configuration" settings, select the "Advanced" tab, and then choose "OAuth" from the dropdown menu.

Under the "Access Token Options" section, select the "Allow OAuth Access Tokens to be used as standalone Bearer Tokens" option. This will allow OAuth access tokens to be used without any associated customer account, as standalone bearer tokens to access resources in Magento 2.

  

Note that enabling this option may increase security risks, as these tokens will not be associated with any specific customer account. Therefore, it is recommended to use this option only for specific use cases where it is necessary to access resources without any customer-specific information.

 

If you find our reply helpful, please give us kudos.

 

A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.

 

WebDesk Solution Support Team

Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789

Thank You,


WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789


Location: 150 King St. W. Toronto, ON M5H 1J9