Interacting with the API

An OpenID server is required in order to enable authorization features in the DeepHub. To achieve this, Keycloak is used for identity and access management. Keycloak is an open-source product (Apache license 2.0) with strong backing from Red Hat.

To interact with the beta version of the DeepHub API, you need to consider the following:

  1. For a request to the DeepHub APIs, an access token must be generated by this service.

  2. To get the token, send a POST message to:

https://dev.deephub.io/auth/realms/omlox/protocol/openid-connect/token

that contains the following X-WWW-FORM-URLENCODED encoded content in the body:

  • grant_type: “client_credentials”

  • client_id: “deephub-beta-client”

  • username: <the username we send you>

  • password: <your newly-created password>

  1. Example with cURL:

curl -L -X POST 'https://dev.deephub.io/auth/realms/omlox/protocol/openid-connect/token'
-H 'Content-Type:application/x-www-form-urlencoded'
--data-urlencode 'grant_type=client_credentials'
--data-urlencode 'scope=openid'
--data-urlencode 'client_id=deephub-beta-client'
--data-urlencode 'client_secret=fbfcb26f-8c6c-4284-8ccb-db0ce4e66712'
--data-urlencode 'user_name=<the username we sent you>'
--data-urlencode 'password=<your newly-created password>'

  1. Use “access_token” from the response for requests made to the DeepHub REST APIs.

{
    "access_token": "eyJhbGciO.................",
    "expires_in": 900,
    "refresh_expires_in": 0,
    "refresh_token": "eyJhbGciOi..............",
    "token_type": "bearer",
    "id_token": "eyJhbGciOiJSUz................",
    "not-before-policy": 1586429949,
    "session_state": "cfd8804d-1c8d-4a6e-ab7f-af60ae1d362b",
    "scope": "openid demo-beta-scope offline_access profile email"
}

../_images/access_token.png

  1. The following table highlights important information needed for both DeepHub versions:

Release Version

Beta Version

Access Token URL

https://api.deephub.io/auth/realms/omlox/protocol/openid-connect/token

https://dev.deephub.io/auth/realms/omlox/protocol/openid-connect/token

Client ID

deephub-release-client

deephub-beta-client

Client Secret

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Base URL

https://api.deephub.io

https://dev.deephub.io

WebSocket API

wss://api.deephub.io/deehpub/v1/ws/socket

wss://dev.deephub.io/deehpub/v1/ws/socket

REST API

/deephub/v1

/deephub/v1

DeepHub UI

/deephub-ui

/deephub-ui