Impact 2024: The Industrial Data and AI Conference for and by Users | Nominate Speakers Now for a Ch...
When I use this an interactive log in window pops up - is this what you refer to? Then it caches after. Yes exactly 🙂. My script is deployed remotely so I can’t do an interactive login at all. Unless I mimic a browser on a headless server 🤓
I have made a couple of convenience classes based on the OIDC examples given here. Perhaps it can be useful to you. import atexitfrom pathlib import Pathfrom cognite.client import CogniteClient, ClientConfigfrom cognite.client.credentials import Tokenfrom msal import PublicClientApplication, SerializableTokenCachefrom publicdata_credentials import credentials as credsclass OIDCInteractiveRefresh: """Convenience class for authentication toward CDF with Open ID Connect interactive refresh. Based on the following exmaple: https://github.com/cognitedata/python-oidc-authentication""" def __init__( self, tenant_id: str=None, client_id: str=None, cdf_cluster: str="api", cognite_project: str=None, client_name: str="" ): """ Initialize authenticator class. Args tenant_id : The ID for the CDF tenant. Type: str client_id : The ID for the CDF client. Type: str cdf_cluster
Hello, I have proceed to clarify on this article which details you should use for Python SDK Details to create the Cognite client when using Postman and Python SDK Tenant ID - 48d5043c-cf70-4c49-881c-c638f5796997, Client ID - 1b90ede3-271e-401b-81a0-a4d52bea3273, project=publicdata, CDF_CLUSTER - api App name: OID-Api You can get the client secret by using the Widget in Open Industrial Data and selecting “Others”. This is explained with more detail in Please let me know if this resolve your concerns. Hello @majofoal ,This doesn’t work. Here is a trace that might be helpful (Checked with both CogniteClient from the SDK and MSAL’s ConfidentialClientApplication authentication ):Error generating access token: invalid_resource, 400, AADSTS500011: The resource principal named https://api.cognitedata.com/user_impersonation was not found in the tenant named Cognite Hub. This can happen if the application has not been installed by the administrator of the tena
Hi @Carin Meems ,I am still struggling with getting the client-id. I restate my question:Do you publicly provide a client id for the Python-SDK for the publicdata project, the way you do for Postman and JS-SDK?Regards,Arian
Hello Rahul,Thanks for answering. The topic you shared on How to connect to OIDC only provides client-id for the Postman and JavaScript applications; not for the Python-SDK. Moreover, using device code is not a viable option for me as it requires to “get a code you can pass to a web page and authenticate there”. So the only option for me would be to use client-id, client-secret.Regards,Arian
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.