<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
System Status
Announcements
Announcements
Search
Search
Select Language
0D54z0000A6xGDgCQMOkta Classic EngineIntegrationsAnswered2026-10-15T16:37:55.000Z2024-04-26T17:01:31.000Z2026-10-15T16:37:55.000Z

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?


  • Paul S. (Okta, Inc.)

    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

    • Okta Identity Engine (OIE)
    • Okta Classic Engine
    • OAuth 2.0
    • API Service Integration
    • System Log API

     

    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.

    1. Create an application in the Okta Admin Console by navigating to Applications, selecting Applications, choosing Create App Integration, and selecting API Services. Alternatively, add the application directly from the Okta Integration Network (OIN) catalog if an API Service Integration exists there.
    2. Grant the application the okta.logs.read OAuth scope to authorize it to read the System Log API.
    3. Authenticate the background service directly to the Okta Authorization Server token endpoint using the generated Client ID and Client Secret, or a Private Key JSON Web Token (JWT).
    4. Pass the short-lived access token returned by Okta in the Authorization Bearer header to fetch data from /api/v1/logs.
    5. Request a new access token using the static client credentials when the token expires.

     

    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).

    Expand Post
    Selected as Best
  • Mihai N. (Okta, Inc.)

    Hi @PavloY.54590 (Customer)​ , Thank you for reaching out to the Okta Community! 

     

    Please check out the options mentioned in the following article to see what would fit better for your use case: 

    https://support.okta.com/help/s/article/Exporting-Okta-Log-Data?language=en_US

     

     

     

     

     

    If my answer helped, remember to mark it as best to increase its visibility for other members of the Okta Community who might have the same questions as you. 

     

    Hope my answer helps! 

     

    --

    Help others in the community by liking or hitting Select as Best if this response helped you.

    Expand Post
  • PavloY.54590 (Customer)

    Hi. Thanks for your answer, but that is a general article describing possibilities, while I am looking for some specific answer. We already have custom api integration but facing issues with refresh_token expiration. Probably because we're using not suitable auth method or different application type, but we're not sure what to use.

    • Mihai N. (Okta, Inc.)

      Hi @PavloY.54590 (Customer)​ For in-depth troubleshooting and configuration review, I recommend opening a case to work with our Support Team. They'll be able to access additional tools and resources to help you get to the bottom of it.  

       

       

      Regards.

      --

      Help others in the community by liking or hitting Select as Best if this response helped you.

      Expand Post
  • Paul S. (Okta, Inc.)

    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

    • Okta Identity Engine (OIE)
    • Okta Classic Engine
    • OAuth 2.0
    • API Service Integration
    • System Log API

     

    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.

    1. Create an application in the Okta Admin Console by navigating to Applications, selecting Applications, choosing Create App Integration, and selecting API Services. Alternatively, add the application directly from the Okta Integration Network (OIN) catalog if an API Service Integration exists there.
    2. Grant the application the okta.logs.read OAuth scope to authorize it to read the System Log API.
    3. Authenticate the background service directly to the Okta Authorization Server token endpoint using the generated Client ID and Client Secret, or a Private Key JSON Web Token (JWT).
    4. Pass the short-lived access token returned by Okta in the Authorization Bearer header to fetch data from /api/v1/logs.
    5. Request a new access token using the static client credentials when the token expires.

     

    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).

    Expand Post
    Selected as Best
This question is closed.
Loading
API integration service development for getting logs data
Okta Support Agent (Beta)

Terms of Service

Hello! I'm the Okta Support Agent (Beta), your go-to resource for questions about Okta products. Please remember for your security and privacy, do not share any Personally Identifiable Information (PII) such as passwords, IP addresses, or other details with me.

Okta Privacy Policy and Terms of Service apply