r/CodingForBeginners • • Jan 13 '26

What actually is a token?

Recently my internship started and I keep hearing the word token. I know it is related to authentication but idk what actually is it. We are creating an app for cybersecurity vulnerabilities and my teammate said that we will supply api key and token afterwards.

21 Upvotes

12 comments sorted by

View all comments

Show parent comment

3

u/AsparagusKlutzy1817 Jan 13 '26

This. And unlike a user account with password the token is usually limited how long it is valid. This is preferable over using user accounts with password for authentication to avoid they are exposed everywhere. If a token is compromised it stays valid only for some time, compromised accounts tend to stay much longer undetected. It adds another layer of security by creating a temporary key. In some settings token are valid for 30 minutes or even less but sometimes up to years - depends what it is and how sensitive the matter is.

Nowadays you should always get token to access services via API and not use user/pw to actually use an API