
PavloY.54590 (Customer) asked a question.
API integration service development for getting logs data
We have a service where we're getting logs data on behalf of our customers. We've been using OAuth OIDC flow, but recently found that refresh token lifetime is only 90 days, which is not suitable for us. Maybe we're using wrong integration or application type. We need to be able to authorize user once and then be able to fetch data on behalf of that user without making him re-auth. What can you recommend?

Updating this response for ease of access and reference:
Overview
The OpenID Connect (OIDC) authorization code flow limits refresh tokens to 90 days, which disrupts background service-to-service data fetching. Resolve this limitation by implementing an OAuth 2.0 Client Credentials grant using an API Service Integration, or by extending the refresh token expiration window in a Custom Authorization Server.
Applies To
Solution
What is the recommended architecture for background log ingestion?
For a background service accessing tenant-level data like logs, the recommended approach involves an OAuth 2.0 Client Credentials grant using an API Service Integration. This Machine-to-Machine (M2M) architecture removes the user from the authentication loop entirely. It provides resilience because the architecture grants access to the application itself, meaning the integration remains active even if the administrator who initially authorized the application leaves the company or experiences a reduction in permissions. It also enforces the principle of least privilege by explicitly requesting the okta.logs.read
scope without exposing broader administrator rights.
The API Service Integration requires specific configuration steps.
Provision the application, grant the required scopes, and configure the service to fetch log data.
How is the refresh token limit extended for specific users?
If the architecture strictly requires acting on behalf of a specific user rather than at the tenant level, administrators can extend the OIDC refresh token limit. Configure an Access Policy within an Okta Custom Authorization Server to extend the maximum refresh token expiration window up to 1825 days (5 years).