The "A" in Jamstack stands for APIs, and offloading complexity to third-party services is what gives static sites their dynamic range. Most of those services require a request to be authenticated, and that authentication can happen either client side or server side depending on the service and the task. Because APIs differ in how they implement auth, integrating them into a Jamstack site adds a layer of difficulty — but each protocol maps to a specific use case.
The OAuth 2.0 framework
OAuth 2.0 is the general standard authentication follows today. It is a flexible authorization framework built from a set of grants that define the relationship between a client and an API endpoint: a client requests an access token from an authorization endpoint and uses it to sign a request to the API. Four grant types cover the main cases.
Authorization Code Grant
Likely the most common of the grant types, the Authorization Code Grant obtains an access token to authorize API requests after a user explicitly grants permission. It runs in two steps:
- The user is sent to a consent screen — the authorization server — and grants the service restricted access to their account and data.
- Once permission is granted, an access token is retrieved from the authentication server and used to authenticate the request to the API endpoint.

The explicit authorization step gives this grant an extra layer of security. Because of the multi-step code exchange, the access token is never exposed; it travels only over a secure backchannel between the application and the auth server, so intercepting a request doesn't hand an attacker a token. Google-owned services such as Gmail and Google Calendar use the authorization code flow to reach personal content in a user's account.
Implicit Grant
The Implicit Grant resembles the authorization code flow with one notable difference: rather than issuing an authorization code that is later exchanged for an access token, the access token is returned immediately through the fragment (hash) portion of the redirect URL — the front channel.

Dropping the authorization code step means tokens can be exposed. Embedded directly in the URL and logged to browser history, the token is easy to grab if the redirect is intercepted. Even so, the implicit flow suits user-agent-based clients such as single-page applications: in client-rendered apps both code and storage are reachable, so there is no safe way to hold client secrets, and the implicit flow is the practical workaround for authenticating a user client side. It is also a valid route around CORS issues, particularly with a third-party auth server that doesn't support cross-origin requests. Given the exposure risk, implicit-flow access tokens tend to be short-lived and refresh tokens are never issued — so a privileged resource may require a fresh login on every request.
Resource Owner Credential Grant

Here the resource owner sends a username and password to the auth server, which returns an access token and an optional refresh token. The credentials are visible in the exchange between client application and authorization server, so a trust relationship must exist between the two. It is clearly less secure than the other grants, but it delivers an excellent experience for first-party clients. It fits cases where the application is highly privileged or works inside a device's operating system, and is often used when other flows aren't viable.
Client Credentials Grant
The Client Credentials Grant obtains an access token outside the context of a user. That makes it the fit for machine-to-machine authentication, where a user's explicit permission can't be guaranteed on every access to a protected resource — CLIs and back-end services, for instance. Instead of a user login, a Client ID and Secret are passed along to obtain a token for authenticating the API request.

A service account is typically established for the application to operate through and call APIs with, keeping users out of the loop while requests still get authenticated. It is common when an application wants access to its own data — analytics, for example — rather than to a specific user's data.
Choosing a flow
Because Jamstack sites lean on third-party services for complex functionality, a well-architected auth solution is essential to their security, and APIs — the primary means of exchanging data — sit at the center of it. The four flows above differ in their benefits and in how they affect user experience. They are the main forms of authentication used to request data from an API, though plenty of others exist and are outlined on oauth.net, which is a thorough deep-dive into the individual types and the OAuth framework as a whole.



