Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception about OAuthClients being expired #693

Open
olevski opened this issue Mar 3, 2025 · 1 comment
Open

Unhandled exception about OAuthClients being expired #693

olevski opened this issue Mar 3, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@olevski
Copy link
Member

olevski commented Mar 3, 2025

If I am not mistaken the oauth clients being expired is something we expect. From time to time. But there are events in Sentry that seems to indicate that we do not handle such cases. I think that probably in this case we dont want to responde with a 500 but something else - like 404 or 401.

Here is the link to the sentry error: https://sentry.dev.renku.ch/organizations/sentry/issues/9154/events/890cc87a12fb4a788a2e7f7f7e36b4fc/

Here is the trace and error:

/app/env/lib/python3.12/site-packages/renku_data_services/repositories/db.py in _get_repository_authenticated at line 123

            adapter = get_provider_adapter(connection.client)
            request_url = adapter.get_repository_api_url(repository_url)
            headers = adapter.api_common_headers or dict()
            if etag:
                headers["If-None-Match"] = etag
            response = await oauth2_client.get(request_url, headers=headers)

The error is:

OAuthError
invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.
@olevski olevski added the bug Something isn't working label Mar 3, 2025
@leafty
Copy link
Member

leafty commented Mar 3, 2025

This is not an expected error. The tokens should be renewed when expired. This error comes from the OAuth2Client not being able to issue a token renewal request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants