Skip to content
Sharp

Authentication · interview question

In the context of Spring Security, why is it important to add a CSRF token to forms?

Multiple choiceMediumchapter-17-curatedpremiumauthenticationjson-web-tokens-jwt
Choose one answer
Answer and explanation

Correct answer

D. To prevent unauthorized actions on behalf of a user.

Why

Adding a CSRF token helps ensure that form submissions are intentional actions from the user, preventing cross-site request forgery where unauthorized actions could be executed.

Test yourself on Authentication

A free test with instant, explained results. No account needed.

Start free test
All Authentication questions →