Insights Hub Credentials¶
Introduction¶
The Insights Hub Credentials contain details for fetching new tokens and store fetched tokens.
Hint
Placeholders in the following samples are indicated by angular brackets < >
.
Creating Credentials Objects¶
Object Name: MindsphereCredentials
Creating Credentials using a User Token¶
Applications can pass a user token which is obtained from the request header to clients using UserToken
object as below:
credentials = UserToken(authorization="<user_token>")
Creating Credentials using App Specific Service Credentials¶
The app specific service credentials are obtained from Developer Cockpit or Operator Cockpit. During the development of an application you may provide the service credentials programmatically. The final application should obtain the client ID, client secret, app name and app version from the environment variables and the host tenant and user tenant from the user token.
Provide app specific service credentials using the AppCredentials
object to obtain technical tokens:
credentials = AppCredentials(
app_name="<app_name>",
app_version="<app_version>",
host_tenant="<host_tenant>",
user_tenant="<user_tenant>",
key_store_client_id="<client_id>",
key_store_client_secret="<client_secret>",
)
Creating Credentials using Tenant Specific Service Credentials¶
The tenant specific service credentials must be provided programmatically or via environment variables. Tenant specific Service Credentials are obtained as described in Accessing Industrial IoT APIs with Service Credentials.
Provide tenant specific service credentials using the TenantCredentials
object to obtain technical tokens:
credentials = TenantCredentials(
client_id="<client_id>",
client_secret="<client_secret>",
tenant="<tenant>"
)
Creating Credentials using Tenant specific Service Credentials for Subtenant Impersonation¶
The tenant specific service credentials for subtenant impersonation must be provided programmatically or via environment variables.
Provide tenant specific service credentials for subtenant impersonation using the TenantCredentials
object to obtain technical tokens:
credentials = TenantCredentials(
client_id="<client_id>",
client_secret="<client_secret>",
tenant="<tenant>",
sub_tenant="<subtenant>"
)