Hi Aniketh,
The following makes the assumption that you are using the platform supported OIDC module at version 2.0 or higher.
Your experience is correct in that the Mendix session is kept alive by user activity and it is separate from the SSO session which is usually based on the expiration datetime of token obtained from your IDP during SSO login.
The OIDC module contains 2 helpful microflows for making use of the token:
1. GetCurrentToken - will return the OAuth token for the currently logged in user that was obtained during the SSO process.
2. GetNewAccessTokenUsingRefreshToken - will use the refresh token (if available) of the currently logged in user to obtain a new token and update the OIDC user token with a new one. Using this as an initial step in your API calls will ensure the user has a valid and non-expired token.
Your Azure app registration and OIDC configuration will need to include the offline_access scope for a refresh token to be included in the original SSO response.