Skip to content
Sharp

Authentication · interview question

In a JWT, why should the secret key used for signing be kept secure?

Multiple choiceMediumchapter-17-curatedpremiumauthenticationjwt-signatures
Choose one answer
Answer and explanation

Correct answer

C. To prevent unauthorized token generation.

Why

If the secret key is exposed, an attacker could generate valid tokens with arbitrary payloads, which could impersonate legitimate users. Keeping the key secure prevents unauthorized use.

Test yourself on Authentication

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

Start free test
All Authentication questions →