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

[proposal] Make headers call for AgentRestClient dynamic #1313

Closed
cre8 opened this issue Jan 16, 2024 · 1 comment · Fixed by #1314
Closed

[proposal] Make headers call for AgentRestClient dynamic #1313

cre8 opened this issue Jan 16, 2024 · 1 comment · Fixed by #1314
Labels
enhancement New feature or request pinned don't close this just for being stale

Comments

@cre8
Copy link
Contributor

cre8 commented Jan 16, 2024

Is your feature request related to a problem? Please describe.
I am using keycloak for the authentication flow. Since the access token is only valid for some minutes, it has to be refreshed from time to time. Right now I can only pass a static token to it like:

        new AgentRestClient({
          url: `${environment.agent}/agent`,
          enabledMethods: enabledIssuerMethods,
          headers: {
            Authorization: `Bearer ${token}`,
          },
        }),

Creating an agent on demand could break some of my veramo plugins. So I thought it would be great to pass the headers either as a static value or to pass a function call.

Describe the solution you'd like
It should be possible to pass either a Record<string, string> or a (() => Record<string, string>) for the header. It's better to make the whole header variable dynamic and not just one specific entry of the record.

Describe alternatives you've considered
Creating an agent from time to time seems not like a best practice. Sphereon updated their client sdks so it should not be a big update. Since a static object can be passed it will not break any existing implementations.

@cre8 cre8 added the enhancement New feature or request label Jan 16, 2024
@mirceanis mirceanis added the pinned don't close this just for being stale label Jan 16, 2024
cre8 added a commit to cre8/veramo that referenced this issue Jan 16, 2024
Fixes decentralized-identity#1313

Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
@mirceanis
Copy link
Member

closed by #1314

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pinned don't close this just for being stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants