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

Add support for OAuth Authentication with automatic token refresh #115

Open
b1zzu opened this issue Oct 25, 2021 · 4 comments
Open

Add support for OAuth Authentication with automatic token refresh #115

b1zzu opened this issue Oct 25, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@b1zzu
Copy link
Collaborator

b1zzu commented Oct 25, 2021

Currently, the SDK supports only the access token which will expire within 15 minutes.

Current behavior:
The ApiClient is generated by default with the HttpBearerAuth authentication class and it can not substitute or overwrite therefore the only way to add a refresh token logic is to wrap the whole API and check if the token is expired before calling the API.

Expected behavior:
The ApiClient should support the OAuth token refresh logic or it should allow the user to pass/set/overwrite the authentication with a custom one.

From some of the existing issues on the openapi-generator project:

jersey2 should have pretty good Oauth support (e.g. automatic token refresh, etc) OpenAPITools/openapi-generator#8702 (comment)

which make me things that we only need to propose an improve to the openapi-generator project

@b1zzu b1zzu added the enhancement New feature or request label Oct 25, 2021
@wtrocki
Copy link
Collaborator

wtrocki commented Oct 25, 2021

@secondsun WDYT?

@secondsun
Copy link
Contributor

I think that this is probably something we can do with just a generator change. I'll take a look at it.

@secondsun secondsun self-assigned this Oct 25, 2021
@b1zzu
Copy link
Collaborator Author

b1zzu commented Oct 26, 2021

I give it a look and I think this is mainly a missing feature with the resteasy java library: https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/Java/libraries/resteasy
and it's already solved in the jersey2 java library
https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/Java/libraries/jersey2

So maybe this could be even an opensource project for an intern

@wtrocki
Copy link
Collaborator

wtrocki commented Oct 26, 2021

We can regenerate OpenAPI with different client (assuming that API would not change much)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants