OAuth in Automations: Permissions, Tokens, and Connections

An automated connection needs valid permissions and credentials to keep working. Learn how OAuth organizes that access and how to keep its scope under control.

By Daniel Sardá · Published on

7 min read1,463 words

In this article · 7 sections

Suppose you want a summary of your calendar events every morning. The tool that prepares it needs to read those events, but it does not need to change or delete them. When you connect your account, a permissions request appears: your decision determines what access the automation can use.

The phrase OAuth authentication in automations often refers to this connection process. One distinction matters from the outset: OAuth 2.0 is an authorization framework. Depending on the case, it allows limited access to a service on behalf of a person or the application itself. Authentication answers a different question: who is accessing the service? RFC 6749 describes the framework and its roles.

This distinction helps explain both the initial permissions screen and what happens weeks later, when the workflow is still running or asks you to reconnect your account.

What you connect when you authorize an automation

In the calendar example, the automation tool acts as the client: it requests access to perform a task. The calendar service provides an API, an interface through which another program can request data or perform operations.

The authorization server manages the grant of access and issues the relevant credentials. The resource server handles requests for protected data—in this case, the events. Both may belong to the same provider, but they perform different functions. You participate as the resource owner who can authorize access. These roles are defined by the OAuth framework. RFC 6749, section 1.1.

A scope expresses the permissions requested or granted. If the provider distinguishes between reading and changing a calendar, requesting read access makes sense for a summary. Available permissions and their level of detail depend on the service: a connection label alone does not tell you which operations it allows.

The access token is the credential the client presents to the API to use the granted authorization. Its format and lifetime depend on the implementation. The user does not need to see it for the connection to use it. RFC 6749, sections 1.4 and 3.3.

Key idea: Authorizing a connection grants specific capabilities. Before accepting, check whether those capabilities match the task you want to automate.

Where identity fits in

You may need to sign in to the provider during the connection process. That step lets the service recognize your account, but it does not make OAuth itself an identity protocol for the connected application.

OpenID Connect adds an authentication layer on top of OAuth 2.0. It can provide an ID token containing information about the user's authentication. That token serves a different purpose from the access token: they should not be used interchangeably. OpenID Connect Core, sections 1 and 2.

From initial permission to each morning's summary

The authorization code flow provides an illustrative example. The screens vary, but the flow shows the logic of a delegated connection:

  1. The tool directs you to the service that manages calendar authorization and requests certain permissions.
  2. You sign in if needed and authorize the requested access. On a first connection, you may see a screen asking you to accept the permissions.
  3. The tool receives an authorization code and exchanges it for an access token at the authorization server.
  4. Using that token, it calls the calendar API to retrieve events and prepare the summary.

The code and the token have different jobs: the code is exchanged to obtain access; the token is then used with the API. This example follows the flow described in section 4.1 of RFC 6749. It is a conceptual example; not all providers or automations use the same grant.

In recommended flows, the connected tool can obtain authorization without receiving your calendar password. Even so, it holds sensitive credentials that need protection. Current security recommendations say the grant that gives the user's password to the client to obtain tokens must not be used. RFC 9700, section 2.4.

An unattended run can still use delegated access

The fact that the summary is generated while you sleep does not mean the application acts on its own behalf. It may still be using an authorization you granted earlier.

Another option is the client credentials grant, or client_credentials. It is intended for confidential clients that can protect their credentials and access their own resources or resources they have been authorized to access in advance. It is not the same as any scheduled task, nor is it a universal substitute for a person's consent. RFC 6749, section 4.4.

It is also useful to distinguish an access token from a client secret. Where applicable, the secret authenticates the client to the authorization server; it is not the permission sent to the calendar API. Not all client types can keep a secret secure. RFC 6749, sections 2.1 and 2.3.

Why a connection may expire or ask for authorization again

An access token can expire. To continue, the tool needs to obtain another one through a mechanism the provider supports. Some connections receive a refresh token, which allows the client to request new access tokens from the authorization server.

The refresh token is not sent to the API to read events. It is intended for the authorization server. Issuing one is optional: an OAuth connection is not guaranteed to have a way to refresh its access, and refresh tokens should not be included in the client credentials grant. RFC 6749, sections 1.5, 4.4.3 and 6.

Key idea: Authorizing a connection once can allow later runs, but continuity depends on valid permissions and credentials and a supported way to obtain access.

Revocation allows tokens to be invalidated. Depending on the service's policy and implementation, it may also affect related tokens. The invalidation can take time to propagate, so it is unwise to promise that every component will stop accepting access at exactly the same moment. RFC 7009, sections 2.1 and 2.2.

If the summary stops arriving, expiration, renewal, or withdrawal of access could be the cause. Check the connection status and the provider's documentation to identify it. Nor should you assume that changing your password cuts off all previous authorizations: revocation policies following security events vary. RFC 9700, section 4.14.2.

What to check to keep access under control

The most useful starting point is the task: what does the automation actually need to do? For the calendar, preparing a summary justifies reading events. If it also requests permission to delete them, that difference deserves attention before you grant access.

The principle of least privilege means limiting permissions to what is needed. OAuth security recommendations also require credentials to be protected and address specific measures for refresh tokens. A stolen token can allow access within its validity conditions. RFC 9700, sections 2.3 and 4.14.

When setting up or maintaining a connection, these checks are practical:

  • Permissions: request the narrowest scope that lets the task run. Read-only access is a useful principle when the workflow only needs to retrieve information.
  • Storage: use a secure credential storage mechanism and avoid copying tokens or secrets into shared documents, messages, or execution logs.
  • Continuity: check how the provider handles expiration, renewal, and reconnection, especially if the workflow must run without daily supervision.
  • Removing access: review connections you no longer use and use the appropriate revocation controls.

A digital threat model helps make this review concrete: what data would be exposed if someone obtained a credential, who can see it, and what operations would it allow?

Connecting a service and protecting the workflow's entry point are separate decisions

So far, the automation has reached out to an API. It may also have an entry point: for example, an HTTP address someone can invoke to start the summary on demand.

Authorizing access to the calendar does not determine who can invoke that address. Review the trigger's controls separately. As an example of this distinction, Microsoft documents OAuth authentication to restrict who can invoke certain HTTP triggers in Power Automate. That behavior belongs to its product and is not a universal configuration. Microsoft documentation.

Key idea: Review both directions: what your automation can access and who can start it.

For the calendar summary, a well-designed connection allows the necessary events to be read, keeps credentials protected, and makes clear how to renew or withdraw access where the provider supports it. When the task changes, review the permissions again. Maintaining that control throughout the connection's life puts your initial decision about access into practice.

About the author

Daniel Sardá is an SEO Specialist, a university-level technician in Foreign Trade from Universidad Simón Bolívar, and editor of Libertatis Venezuela. He writes on liberalism, political economy, institutions, propaganda and individual liberty from an independent, non-partisan perspective.

Read full profile