Magento Expert Forum - Improve your Magento experience

Results 1 to 2 of 2

How to Add Form Key in Magento 2

  1. #1
    Junior Member
    Join Date
    Nov 2022
    Location
    CA, USA
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to Add Form Key in Magento 2

    Cross-site request forgery in Magento 2 can be avoided by adding a form key to the Phtml code.

    According to Wikipedia, cross-site request forgery results in
    "An attacker deceives an innocent end-user into sending a web request that they did not intend. This could result in actions being taken on the website, such as unintentional client or server data leaking, session state modification, or account manipulation.

    When you add a form key to Magento 2, you protect your website from spammers trying to post to your forms from other websites pretending to be you!

    By putting the solution into practice, Magento will be instructed to look for a layout block named "formkey," output it and store it for the duration of a user session.

    Visit here for a programmatical solution.
    https://meetanshi.com/blog/add-form-key-in-magento-2/

    View more threads in the same category:


  2. #2

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •