Skip to content

Get Africoders on your phone

Abdulfatai

@abdulfatai

journal

Authentication vs Authorization โ€” they are NOT the same thing. ๐Ÿ”

6 replies 9 views

Authentication vs Authorization โ€” they are NOT the same thing. ๐Ÿ” If youโ€™re learning backend development, you need to understand this difference. Imagine you want to enter a company. First, the security guard asks for your ID card. If the ID proves that you are who you claim to be, you are allowed into the building. That is Authentication. ๐Ÿ‘‰ Authentication = Who are you? Now, imagine youโ€™ve entered the company. Youโ€™re an employee, but you canโ€™t just walk into the CEOโ€™s office or access the companyโ€™s private database. Your role determines what youโ€™re allowed to access. That is Authorization. ๐Ÿ‘‰ Authorization = What are you allowed to do? In a web application: Authentication Login with email/password Verify OTP Verify identity Create/manage a session or token Authorization Admin can delete users User can view their own orders Manager can access certain resources Regular users cannot access admin routes The easiest way to remember it: ๐Ÿ” Authentication โ†’ Who are you? ๐Ÿ›ก๏ธ Authorization โ†’ What can you access? You can be authenticated but not authorized to perform a particular action. For example, you can successfully log into an admin dashboard as a normal user, but you shouldn't be able to delete another user's account. Authentication comes first. Authorization decides what happens after. If you're learning backend development, don't just memorize these terms. Understand how they work together. ๐Ÿš€
View passport

Replies

6 replies

Sign in to reply.