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 async auth provider #147

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

yarinvak
Copy link
Contributor

@yarinvak yarinvak commented Feb 17, 2023

Pull Request Description

Resolves #77

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Locally tested against Fireblocks API

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules
  • I have added corresponding labels to the PR

@yarinvak yarinvak added the enhancement New feature or request label Feb 17, 2023
@github-actions github-actions bot added the chore label Feb 17, 2023
@yarinvak yarinvak requested review from YoavBZ and idanya and removed request for YoavBZ February 17, 2023 12:19
this.axiosInstance.interceptors.request.use(async (config: any) => {
config.headers.common["X-API-Key"] = await this.authProvider.getApiKey();
config.headers.common["User-Agent"] = this.getUserAgent();
return config;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should we run this on every request? These header don't change. But if we already have an interceptor, let's move signJwt() into it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do you suggest calculating it if not here? It's an async function, can't execute it in the constructor

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.
We should move sign_jwt() in here as well.
This way the consumer can use the same SDK instance to run commands on multiple accounts. Because the API Key and the JWT are coupled it makes little sense to allow changing only one.

@fmorisan
Copy link

Hi, any updates on this PR? Is this going to be merged eventually? Seems that progress/discussion has stopped.

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

Successfully merging this pull request may close these issues.

Asynchronous jwt sign
4 participants