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
input
: AcquireOauthTokensInput
-
Returns
Example¶
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())