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

Credentials don't use axios instance provided when creating the client #183

Open
6 tasks done
wassil opened this issue Dec 10, 2024 · 1 comment
Open
6 tasks done
Labels
bug Something isn't working

Comments

@wassil
Copy link

wassil commented Dec 10, 2024

Checklist

  • I have looked into the README and have not found a suitable solution or answer.
  • I have looked into the documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have upgraded to the latest version of OpenFGA and the issue still persists.
  • I have searched the Slack community and have not found a suitable solution or answer.
  • I agree to the terms within the OpenFGA Code of Conduct.

Description

I'm using a custom axios client to initialize OpenFgaClient, because our code runs in a VPC and requests need to go through proxy.
I found out that "credentails" are using default axios client, so it's unusable in our case.
Not sure if this is a bug or a feature requests, but it seems reasonable that the axios instance provided will be used for all requests.

To be exact, function refreshAccessToken:

}, globalAxios);

It should be using this.axios.
Further, the SDK calls Credentials.init, so it never sets the axios instance https://github.com/openfga/js-sdk/blob/main/base.ts#L51
I guess you could just add an extra parameter for init with axios.

If needed I can make a PR, but you will be a lot faster than me.

Expectation

Axios client provided should be used for all requests, including getting access token.

Reproduction

  1. Initialize the SDK with custom axios instance with e.g. logging interceptor.
  2. Make any call e.g. check
  3. See that the interceptor is not called for refreshing access token

OpenFGA SDK version

0.7.0

OpenFGA version

Auth0 FGA, not sure what version is that

SDK Configuration

With a custom axios client

Logs

No response

References

No response

@wassil wassil added the bug Something isn't working label Dec 10, 2024
@rhamzeh rhamzeh moved this from Backlog to Ready in SDKs and Tooling Dec 10, 2024
@rhamzeh
Copy link
Member

rhamzeh commented Dec 16, 2024

@wassil thank you for the bug report - we'll be taking a look at this at some point in the new year. However you don't have to wait; if you're willing to submit a PR, we'll gladly review it

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
Status: Ready
Development

No branches or pull requests

2 participants