API Authentication Handling ගෙන කතා කරමු
July 29, 2024 · 1 min read · Originally on Medium
API (Application Programming Interface) කියන්නේ software developers ලට විවිධ systems සහ services එක්ක සම්බන්ධ වෙන්න, data exchange කරන්න අවස්ථාව ලබා දෙන method එකක්. ඉතින් API එකක් හරහා communication secure කරන්නනම්, Authentication mechanisms use කරලා තහවුරු කරගන්න ඕනේග
Authentication කියන්නේ මොකක්ද?
Authentication කියන්නේ user කෙනෙක් හරි system එකක් හරි , request එකක් කරන්න attempt කරනකොට, ඒක valid ද කියලා check කරන process එකක්. මේකට ගොඩක් methods තියනවා.
API Key Authentication
API Key Authentication කියන්නේ ඉතාමත් simple method එකක්. මේක use කරන්නේ API access කරන්න කැමති application එකකට (client) unique key එකක් assign කරලා. ඊට පස්සෙ, client එකෙන් request එකක් එනකොට, ඒ key එක use කරලා server එකේ API authenticate කරනවා. මේක ගොඩක් තැනවල use වෙනවා .
OAuth 2.0
OAuth 2.0 කියන්නේ third-party applications වලට user accounts access කරන්න දෙන framework එකක්. මෙක use කරන්නන් users ලගේ password දෙන්නෙම නැතුව, authorization tokens use කරනවා. OAuth use කරනකොට users ලට වෙනම application එකක් access කරලා approve කරන්න පුළුවන්.
JWT (JSON Web Tokens)
JWT කියන්නේ JSON format එකේ tokens. API authentication, authorization purposes වලට use කරනවා. JWT තියෙන්නෙ header, payload, signature කියන parts 3කින්. User එකකට once logged in වෙලා, server එකෙන් JWT issue කරනවා. පස්සේ user එක request එකක් දාන්න යනකොට, JWT එක attach කරලා එනවා. Server එකට.Server එක tokens validity check කරලා access දෙනවා.

Nisal Gunawardhana. 2024
Enjoyed this? Follow me on Medium.
New articles on AI, cloud, GitHub and building software.