Skip to main content
Version: V3.0

Authorization API


Authorization Code Grant - Get Authorization Code

Request URL

GET /api/v1.0/invoke/open-ability/method/oauth2/auth

Request Parameter

Parameter NameTypeLocationRequiredDescription
scopeStringQueryYesAuthorization scope, the value is user
stateStringQueryYesClient state
redirect_uriStringQueryYesRedirect URI
response_typeStringQueryYesResponse type, the value is code
client_idStringQueryYesClient ID

Return Parameter

Parameter NameTypeLocationDescription
stateStringQueryClient state, consistent with the input parameter
codeStringQueryAuthorization code

Request Example

GET /api/v1.0/invoke/open-ability/method/oauth2/auth?scope=user&state=1&response_type=code&client_id=caa0b4dffd57202a157bf46664f93c192&redirect_uri=https://demo.akubela.com

Success Return Example

https://demo.akubela.com?state=1&code=cb66a21f7d9fe1a141676a563c5a7eacf

Failure Return Example

Null



Authorization Code Grant - Get Access Token

Request URL

POST /api/v1.0/invoke/open-ability/method/oauth2/token

Request Parameter

Parameter NameTypeLocationRequiredDescription
Content-TypeStringHeaderYesContent type, the value is application/x-www-form-urlencoded
AcceptStringHeaderYesAccept, the value is application/json
grant_typeStringBodyYesGrant type, the value is authorization_code
codeStringBodyYesAuthorization code
client_idStringBodyYesClient ID
client_secretStringBodyYesClient secret
redirect_uriStringBodyYesRedirect URI
expires_inIntegerBodyNoToken expiration time (s)

Return Parameter

Parameter NameTypeLocationDescription
Content-TypeStringHeaderContent type, the value is application/json
successBooleanBodyWhether the request is successful or not?
true: success
false: failure
timestampIntegerBodyTimestamp
resultObject<result>BodyReturn result

result description

Parameter NameTypeLocationDescription
access_tokenStringBodyAccess token
refresh_tokenStringBodyRefresh token
token_typeStringBodyToken type, the value is bearer
expires_inIntegerBodyToken expiration time (s)

Request Example

POST /api/v1.0/invoke/open-ability/method/oauth2/token

Content-Type: application/x-www-form-urlencoded

Accept: application/json

grant_type=authorization_code&

code=cb66a21f7d9fe1a141676a563c5a7eacf&

client_id=caa0b4dffd57202a157bf46664f93c192&

client_secret=s75b058bfd9e4e0659d75b67a03334745&

redirect_uri=https://demo.akubela.com

Success Return Example

Status Code: 200

Content-Type: application/json

{
"success": true,
"timestamp": 1540869200562,
"result": {
"access_token": "ad5db2a3d3ab09e5890c4ffba9eaf3c55",
"refresh_token": "r91b9ba8bc024e23617f63f908dc15950",
"token_type": "bearer",
"expires_in": 3600
}
}

Failure Return Example

See Failure Return Example



Password Grant - Get Access Token

Request URL

POST /api/v1.0/invoke/open-ability/method/oauth2/token

Request Parameter

Parameter NameTypeLocationRequiredDescription
Content-TypeStringHeaderYesContent type, the value is application/x-www-form-urlencoded
AcceptStringHeaderYesAccept, the value is application/json
grant_typeStringBodyYesGrant type, the value is password
client_idStringBodyYesClient ID
client_secretStringBodyYesClient secret
scopeStringBodyYesAuthorization scope, the value is user
usernameStringBodyYesUsername
passwordStringBodyYesPassword
expires_inIntegerBodyNoToken expiration time (s)

Return Parameter

Parameter NameTypeLocationDescription
Content-TypeStringHeaderContent type, the value is application/json
successBooleanBodyWhether the request is successful or not?
true: success
false: failure
timestampIntegerBodyTimestamp
resultObject<result>BodyReturn result

result description

Parameter NameTypeLocationDescription
access_tokenStringBodyAccess token
refresh_tokenStringBodyRefresh token
token_typeStringBodyToken type, the value is bearer
expires_inIntegerBodyToken expiration time (s)

Request Example

POST /api/v1.0/invoke/open-ability/method/oauth2/token

Content-Type: application/x-www-form-urlencoded

Accept: application/json

grant_type=password&

client_id=caa0b4dffd57202a157bf46664f93c192&

client_secret=s75b058bfd9e4e0659d75b67a03334745&

username=ucaa0b4dffd57202a157bf46664f93c19&

password=pucaa0b4dffd57202a157bf46664f93c1&

scope=user

Success Return Example

Status Code: 200

Content-Type: application/json

{
"success": true,
"timestamp": 1540869200562,
"result": {
"access_token": "ad5db2a3d3ab09e5890c4ffba9eaf3c55",
"refresh_token": "r91b9ba8bc024e23617f63f908dc15950",
"token_type": "bearer",
"expires_in": 3600
}
}

Failure Return Example

See Failure Return Example



Refresh Access Token

Request URL

POST /api/v1.0/invoke/open-ability/method/oauth2/token

Request Parameter

Parameter NameTypeLocationRequiredDescription
Content-TypeStringHeaderYesContent type, the value is application/x-www-form-urlencoded
AcceptStringHeaderYesAccept, the value is application/json
grant_typeStringBodyYesAuthorization type, the value is refresh_token
client_idStringBodyYesClient ID
client_secretStringBodyYesClient secret
refresh_tokenStringBodyYesRefresh token
expires_inIntegerBodyNoToken expiration time (s)

Return Parameter

Parameter NameTypeLocationDescription
Content-TypeStringHeaderContent type, the value is application/json
successBooleanBodyWhether the request is successful or not?
true: success
false: failure
timestampIntegerBodyTimestamp
resultObject<result>BodyReturn result

result description

Parameter NameTypeLocationDescription
access_tokenStringBodyAccess token
refresh_tokenStringBodyRefresh token
token_typeStringBodyToken type, the value is bearer
expires_inIntegerBodyToken expiration time (s)

Request Example

POST /api/v1.0/invoke/open-ability/method/oauth2/token

Content-Type: application/x-www-form-urlencoded

Accept: application/json

grant_type=refresh_token&

client_id=caa0b4dffd57202a157bf46664f93c192&

client_secret=s75b058bfd9e4e0659d75b67a03334745&

refresh_token=r91b9ba8bc024e23617f63f908dc15950

Success Return Example

Status Code: 200

Content-Type: application/json

{
"success": true,
"timestamp": 1540869200562,
"result": {
"access_token": "ad5db2a3d3ab09e5890c4ffba9eaf3c53",
"refresh_token": "r91b9ba8bc024e23617f63f908dc15952",
"token_type": "bearer",
"expires_in": 3600
}
}

Failure Return Example

See Failure Return Example