use aio-lib-state and aio-lib-file in web-src? | Community
Skip to main content
Urs_Boller
Community Advisor
Community Advisor
September 12, 2020
Solved

use aio-lib-state and aio-lib-file in web-src?

  • September 12, 2020
  • 1 reply
  • 1291 views

Having an app scren, is it possible to use the libraries aio-lib-state or aio-lib-files and access the data? eg. I want to have some "basic logs" save somewhere and display it on an app screen (component). or do I need to write an action fetching the desired data and then display the response?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by duynguyen_adobe

Hi @urs_boller , it is possible to use aio-lib-state and aio-lib-files in the UI components in `web-src/`, same as any nodejs code. However it does not have the built-in authentication like in the backend action which leverages the namespace credentials to obtain access tokens to State and Files. You would have to manage the authentication in your code. IMO this is not a secure way of using State and Files libs because there are too many vulnerability risks in the frontend code. The best way would still going through the action with `require-adobe-auth` enabled.

1 reply

duynguyen_adobeAdobe EmployeeAccepted solution
Adobe Employee
September 14, 2020

Hi @urs_boller , it is possible to use aio-lib-state and aio-lib-files in the UI components in `web-src/`, same as any nodejs code. However it does not have the built-in authentication like in the backend action which leverages the namespace credentials to obtain access tokens to State and Files. You would have to manage the authentication in your code. IMO this is not a secure way of using State and Files libs because there are too many vulnerability risks in the frontend code. The best way would still going through the action with `require-adobe-auth` enabled.

Urs_Boller
Community Advisor
Community Advisor
September 14, 2020
Hi @duynguyen_adobe security is an important case, was just looking for a "quick way". I now implemented a generic action that both handles "getData" and "updateData" for a single screen (based on parameters) and enabled the 'require-adobe-auth'. Works good and just a few lines more than having within the main component itself.