Grant Negotiation and Authorization Protocol (GNAP) is a next-generation authorization and delegation protocol, published by the IETF as RFC 9635 in October 2024, which might replace OAuth 2.0 in the future. GNAP enables clients to interact with multiple resources, negotiate access, and obtain authorization in flexible ways.
GNAP aims to overcome the limitations of OAuth 2.0. It is more flexible and privacy-enhancing, with improved security, a better developer experience, and greater interoperability.
Read the GNAP core protocol specification (RFC 9635).
Learn more in our detailed guide to authentication vs authorization
In this article:
Limitations of OAuth 2.0 and the Need for GNAP
OAuth 2.0, introduced in 2012 as RFC 6749, has been a foundational protocol for securing authorization. OAuth 2.0 became popular because it is widely supported and deployed, adapts to new use cases, and is relatively straightforward to implement without deep security knowledge.
OAuth 2.0 also has limitations that prompted the development of GNAP:
- Reliance on browser redirects: This can limit the utility of OAuth 2.0 in scenarios where a browser is not the primary client, such as with certain mobile and desktop applications. The authentication process may then require a system browser, which interrupts the flow of native applications and degrades the user experience.
- Developer experience: OAuth 2.0’s developer experience is considered old-fashioned by current standards. The protocol heavily uses form parameters, which are less flexible than modern JSON structures. Additionally, OAuth does not provide a discovery process for OAuth endpoints as part of the protocol.
- Security: The protocol commonly issues bearer tokens, which anyone who obtains them can use, so they are open to interception and misuse. Although “proof of possession” mechanisms like DPOP and MTLS exist, they are not widely adopted because they are complex and hard to deploy.
- Complexity: OAuth 2.0 spans multiple specifications, which can be daunting for those new to the protocol. Developers need to understand several RFCs, which steepens the learning curve and complicates development.
GNAP aims to fix these issues. It improves the developer experience with more modern data structures for communication and simpler discovery of service endpoints. It aims to reduce reliance on bearer tokens, which lowers security risk. GNAP also aims to improve the user experience, particularly on mobile platforms, by interrupting native application flows less often for authentication.
Related Content: Read Our Magic Links Guide
How GNAP Works
This section covers the roles in GNAP, the elements of the authentication process, and the authentication flow.
Roles in GNAP
End User
The end user is the individual who uses a client application and owns the data or resources that the application wants to access. GNAP lets the user grant or deny access to their data and specify the level and duration of access. This gives users full control over their personal data, so they can protect it from unauthorized access.
Authorization Server
The authorization server issues access tokens to the client after successful authorization. It evaluates the client’s request, interacts with the end user for consent, and issues tokens according to the user’s authorization, so that only legitimate clients get access to the user’s data.
Resource Owner
The resource owner is the entity that has the authority to grant access to a particular resource. This could be the end user, or a third party that manages the resource on their behalf. The resource owner’s role is to make sure the resource is accessed securely and in a controlled way. GNAP gives resource owners a way to manage access to their resources.
Resource Server
The resource server is the server hosting the resources that the client wants to access. Once the client has obtained an access token from the authorization server, it can use this token to access resources on the resource server. The resource server validates the token and provides the requested resources if the token is valid. This ensures that only authorized clients can access the resources.
Client
The client is the application or service that wants to access the end-user’s data or resources. It could be a web app, a mobile app, or any other type of application. The client initiates the GNAP process by sending a request to the authorization server, seeking authorization to access the data. The client’s role is to provide a smooth and secure experience for the end user, while accessing their data according to permissions they have granted.
GNAP Elements
Subject
The subject is the entity whose attributes are being evaluated for granting access. This could be a person, a device, or a software application. The subject initiates the GNAP process by sending a request to the GNAP server to access a specific resource. The subject’s request includes their attributes and the rights they wish to exercise on the desired resource.
Subject information
Subject information refers to the data that identifies and describes the subject. This includes the subject’s identity and the associated security credentials. This information allows the GNAP server to authenticate the subject and determine their authorization level.
Attribute
An attribute is a piece of data that characterizes the subject. This could be the subject’s role in an organization, their geographic location, the device they are using, etc. The GNAP server uses attributes to decide the subject’s access rights.
Right
This is the specific action that the subject is authorized to perform on a resource. This could include activities like reading, writing, updating, or deleting data. The rights that a subject can exercise on a resource are determined by the GNAP server based on the subject’s attributes and the policies defined for the resource.
Access token
An access token is a digital key issued by the GNAP server to the subject after successful authentication and authorization. The access token encapsulates the subject’s approved rights and is used by the subject to access the protected resource. The token’s validity is typically time-bound and may be revoked by the GNAP server at any time.
Protected resource
A protected resource is the digital asset that the subject wants to access. This could be a database, a file, a web service, etc. The protected resource relies on the GNAP server to authenticate and authorize access requests, so that only authorized subjects can access and manipulate the resource.
Grant
A grant in GNAP is the permission given to the subject to exercise specific rights on a resource. The grant is based on the subject’s attributes and the resource’s policies. The GNAP server issues a grant after validating the subject’s request and verifies the grant each time the subject uses their access token.
Privileges
These are the rights that the subject has been granted on the resource. Privileges define what the subject can do with the resource: read it, write to it, update it, delete it, etc. They are encapsulated in the access token and are enforced by the protected resource.
Related Content: Read Our FIDO2 Guide
GNAP Authentication Flow
The GNAP IETF Draft defines the official authentication flow. Refer to the document for the full process flow. Below is a simplified explanation of the key steps.
Client’s Request to the Authorization Server
The GNAP flow begins when the client sends a request to the authorization server. This request contains information about the client’s desired access, the client’s capabilities, and the client’s interaction preferences. The authorization server then responds with an interaction handle, a continuation URI, and an access token, if immediate access is granted.
Interaction Steps Between the End-User and authorization server
Following the client’s request, the end-user interacts with the authorization server. This interaction can take various forms, depending on the client’s and the end-user’s preferences. The end-user may be asked to authenticate, provide consent, or complete other tasks as needed. Once the interaction is complete, the end-user is directed to the continuation URI.
Token Issuance by the authorization server
After the end-user completes the interaction, the authorization server issues a token. This token represents the granted rights and is bound to the client instance. The client can then use this token to access the desired resources.
Client’s Access to the RS Using the Token
The client uses the issued token to access the RS. The RS validates the token, checks the associated rights, and serves the request if the token is valid and the rights are sufficient. This step completes the GNAP flow.
GNAP vs. OAuth 2.0: Key Differences
Flexibility and Interaction
OAuth 2.0 has a rigid flow and limited interaction capabilities. GNAP offers more dynamic negotiation options and interaction models, so you can tailor the protocol to your needs, including complex multi-party scenarios and non-browser based applications. GNAP’s interaction options are also not limited to redirections, which makes it more user-friendly and versatile.
Customer Identification
With OAuth 2.0, customer identification could be challenging. OAuth 2.0 relied heavily on bearer tokens which, while convenient, didn’t provide strong identification. GNAP supports various types of tokens, including reference and structured tokens. These tokens can be bound to a specific client instance, making customer identification more secure and reliable.
Rich Token Introspection
GNAP’s token introspection is richer and more detailed than OAuth 2.0’s. It gives more detail on a token’s status and associated data, including metadata such as its issuance time, expiration date, and scope of access. This information can be useful for managing and securing applications.
Security Concerns
GNAP addresses several security problems in OAuth 2.0. For instance, GNAP minimizes bearer token usage, reducing the risk of token leakage. It provides flexible interaction options, allowing for better user consent and privacy.
Using OAuth with Frontegg
Frontegg’s end-to-end and self-served authentication infrastructure is based on JSON Web Tokens. Our JWTs have been designed to adhere to the highest security standards. Therefore, our user management solution is also fully compliant with the OAuth protocol and with OpenID Connect 1.0 (OIDC).
Put this into practice with Frontegg
Frontegg is customer identity and access management (CIAM) for B2B SaaS. It's free up to 7,500 monthly active users, including 5 SSO/SCIM connections.
Start for freeThe Complete Guide to SaaS Multi-Tenant Architecture
Read the guide