Identity and Access Management. Part 4: API Authorization

Ishan Dhar
3 min readJul 21, 2023

--

In part 1 of this series we understood Authentication and Authorization.
In part 2 we understood “Identity Federation, Authentication Broker, and Identity Providers”.
In part 3 we understood about common Protocols.
Now lets understand API Authorization

API Authorization

API Authorization is the process of securely controlling access to APIs (Application Programming Interfaces) and the resources exposed by them. It ensures that only authorized users or applications can interact with the API and perform specific actions. API Authorization is crucial for maintaining data integrity, protecting sensitive information, and preventing unauthorized access or misuse of APIs.

  1. API Keys: API Keys are a common method of API Authorization. They are unique identifiers issued to developers or applications that need access to an API. API Keys are typically included in API requests as a parameter or header, allowing the API to validate the identity and permissions of the requester. API Keys are often used for authentication as well as rate limiting and usage tracking. Examples: Google Maps API Key, Stripe API Key.
  2. OAuth 2.0 for API Authorization: OAuth 2.0 is widely used for delegated authorization and is also applicable to API Authorization. OAuth 2.0 enables secure and controlled access to APIs by allowing users to grant limited permissions to third-party applications without sharing their credentials. It involves obtaining an access token that represents the user’s authorization to access specific resources or perform actions on their behalf. Examples: Using OAuth 2.0 to authorize API access for social media applications, such as allowing an app to post on behalf of a user on Twitter.
  3. OpenID Connect and API Authorization: OpenID Connect, which is built on top of OAuth 2.0, can be utilized for API Authorization scenarios. It provides a mechanism for user authentication and can generate ID tokens that contain user identity information. These ID tokens can be used to authorize API access based on the user’s identity or associated attributes. Examples: Using OpenID Connect to authenticate users and authorize their access to specific API resources based on their identity or user attributes. Tools: Keycloak, Okta, Azure Active Directory.
  4. JWT (JSON Web Tokens): JSON Web Tokens (JWT) are a compact, URL-safe format for representing claims between two parties. JWTs can be used for API Authorization by encoding authorization-related information such as user roles or permissions within the token. The API can verify the integrity and authenticity of the JWT to determine the access privileges of the requester. Examples: Using JWTs as access tokens for API authorization in a microservices architecture.
  5. API Gateway: An API Gateway is a central entry point for API requests and can include API Authorization capabilities. It acts as a reverse proxy, receiving API requests, and forwarding them to the appropriate services. API Gateways can enforce authentication, authorization, and other security policies, enabling fine-grained control over API access. Examples: Kong, Apigee, AWS API Gateway.
  6. Role-Based Access Control (RBAC) for APIs: Role-Based Access Control (RBAC) can be applied to API Authorization, allowing permissions to be assigned based on predefined roles. Roles define sets of permissions, and users or applications are associated with specific roles. RBAC simplifies API Authorization by providing a structured and scalable approach to managing access control for various API resources. Examples: Using RBAC to grant different levels of API access based on user roles, such as allowing administrators full access while restricting certain actions for regular users. Tools: Keycloak, Open-source: Apache Ranger, Paid: Okta, Microsoft Azure Active Directory.

API Authorization ensures that API resources are accessed only by authorized users or applications, safeguarding data and maintaining control over API usage. Implementing proper API Authorization mechanisms, such as API keys, OAuth 2.0, JWTs, and RBAC, can help organizations achieve secure and controlled access to their APIs, protecting valuable resources and maintaining the integrity of their systems. Integration with API Gateways can further enhance security and provide centralized control over API Authorization policies.

--

--