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 credential providers with the ability to refresh tokens in Pyodide #1155

Open
evertoncolling opened this issue Feb 20, 2023 · 2 comments

Comments

@evertoncolling
Copy link
Contributor

The latest release of the Cognite Python SDK adds support for Pyodide and it works great if the client is instantiated with a Token generated somewhere else. Any of the current credential providers that rely on msal are not working in Pyodide and some work might need to be done to patch msal to work without regular requests.

@haakonvt
Copy link
Contributor

Adding to the issue: For client credentials (OAuthClientCredentials), which doesn't use the msal package, the error is different:

JsException:
  NetworkError:
    Failed to execute 'send' on 'XMLHttpRequest':
      Failed to load 'https://login.microsoftonline.com/0d75f6b8-c6b9-4e84-baca-503e08aa7e4a/oauth2/v2.0/token'.

@haakonvt
Copy link
Contributor

Adding another similar-in-nature issue:
Calling e.g. client.iam.service_accounts.list() which for many projects have been deactivated and returning 404, will raise a pyodide.JsException instead of subclass of CogniteException like CogniteAPIError. Needs to add or patch a check for it.

Found by @ks93

https://pyodide.org/en/0.19.1/usage/api/python-api.html#pyodide.JsException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants