Skip to content

Acquire OAuth Tokens

Attempts to acquire OAuth access token from vendor. If successful, get device details from vendor and create device objects in Kraken.

Authentication Required

Requires account user level access.

Arguments

Returns

1
2
3
4
5
mutation acquireOauthTokens($input: AcquireOauthTokensInput!) {
    acquireOauthTokens(input: $input) {
        tokensAcquired
    }
}
1
2
3
4
5
6
7
8
# Input variables
{
    "input": {
        "accountNumber": "",
        "authCode": "",
        "state": "",
    }
}

Example

1
2
3
4
5
mutation acquireOauthTokens($input: AcquireOauthTokensInput!) {
    acquireOauthTokens(input: $input) {
        tokensAcquired
    }
}
1
2
3
4
5
6
7
8
# Input variables
{
    "input": {
        "accountNumber": "A-1234567",
        "authCode": "hOcCupT0P1pUS0xfQiorMrLarWKAHRhTfH_xkGf7U4",
        "state": "93e89fa3d6514ed498a7ef7650442a83",
    }
}
import json

import pprint

import requests

# API_URL = "https://api.oeus-kraken.energy/v1/graphql/" # prod
API_URL = "https://api.oeus-kraken.systems/v1/graphql/" # test
JWT_TOKEN = "PLACE_JWT_TOKEN_HERE"
HEADERS = {
    "Authorization": f"JWT {JWT_TOKEN}"
}

MUTATION = “”"
mutation acquireOauthTokens($input: AcquireOauthTokensInput!) {
    acquireOauthTokens(input: $input) {
        tokensAcquired
    }
}
“”"

VARIABLES = {
    "input": {
        "accountNumber": "A-1234567",
        "authCode": "hOcCupT0P1pUS0xfQiorMrLarWKAHRhTfH_xkGf7U4",
        "state": "93e89fa3d6514ed498a7ef7650442a83",
    }
}

session = requests.Session()
session.headers.update(HEADERS)
response = session.post(
    url=API_URL,
    json={query: MUTATION, variables: VARIABLES}
)
pprint.pprint(response.json())
1
2
3
4
5
 "data": {
        "acquireOauthTokens"{
            "tokensAcquired": "true"
        }
    }
Back to top