API Authentication (GQL)
Read, create, or update an API's authentication set.
Read an API's authentication set
Use query.api
, specifying the API ID as an input parameter. Each version of the API can have its own authentication set, so the versions.accessControl.authentication
field is used to obtain the authentication information for each version. The authParams
field specifies OAuth scopes (if any).
query {
api(id: "api_6040d9e7-3d00-43d5-bc51-b7exxxxx") {
id
versions{
id
name
accessControl{
authentication{
id
apiVersionId
authType
description
accessTokenUrl
authorizationUrl
requestTokenUrl
grantType
separator
clientSecretRequired
clientAuthentication
authParams {
id
name
description
authentication
}
handleOauthTokenAtFrontend
}
}
}
}
}
Create or update an API's authentication set
Example of changing an API's authentication set to OAuth2. You must specify the apiVersionId
. The authParams
field specifies OAuth scopes (if any). Use query.api
(see above) to read more information related to the authentication set.
mutation createOrUpdateAPIVersionAuthentication($input: createAuthenticationInput) {
createOrUpdateAPIVersionAuthentication(input: $input) {
id
authParams {
id
name
description
authentication
}
}
}
{
"input": {
"apiVersionId": "apiversion_d3e1e196-4fae-4d52-a012-82b0xxxxx",
"authentication": {
"authType": "OAUTH2",
"authParams": {
"name": "admin",
"description": "OAuth scope for admin rights."
},
"accessTokenUrl": "https://example.com/token",
"clientAuthentication": "HEADER",
"grantType": "CLIENT_CREDENTIALS",
"separator": "SPACE"
}
}
}
Updated 12 months ago