Get Access Token and Refresh Token
Path
http://{supOS ip:port}/open-api/auth/v2/oauth2/token
Request body
{
"grantType": "authorization_code", //refresh_code or authorization_code
"code": "string", //required for authorization_code
"logoutUri": "string", //required for authorization_code
"refreshToken": "string" //required for refresh_code
}
Response
- 200: Successful.
{
"accessToken": "string",
"expiresIn": "string",
"refreshToken": "string",
"username": "string",
"personCode": "string",
"companyCode": "string",
"accountType": 0
}
- 400
{
"code": 100106500,
"message": "invalid grant_Type"
}
- 401
{
"code": 100106403,
"message": "invalid accessToken"
}
Add Third-party Authentication Center
Path
http://{supOS ip:port}/open-api/auth/v2/oauth2/identity/provider/instances
Request body
{
"clientType": "internal", //required. Internal means embedded client
"protocolType": "bluetron", //required
"clientName": "test1",
"enabled": true,
"clientId": "test", //required
"clientSecret": "xxxxx", //required
"authorizationUri": "http[s]://{host:port}/{prefix}/authrize", //required
"tokenUri": "http[s]://{host:port}/{prefix}/token", //required
"userinfoUri": "http[s]://{host:port}/{prefix}/userinfo", //required
"logoutUri": "http[s]://{host:port}/{prefix}/logout" //required
}
Response
- 200: Successful.
{
"redirectUri": "http[s]://xxx/xx/xxx/xxx/authrize?protocolType=bluetron"
}
- 400
{
"code": 100106023,
"message": "client already exists"
}
100106500: 'authorizationUri' cannot exceed 256 in length.
Get Access Token on Client
Path
http://supOS ip:port/{basePath}/oauth2/client/v1/accessToken
Query parameter
- grantType: Set to 'client_credential'. Required.
- appId: Unique credential of the third party user. Required.
- secret: Unique credential key of the third party user. Required.
Response
- 200: Successful.
{
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJwelhpeXRYVHZVVmx6YTloUC1tZTdEUXNLbXlvRkxLSmFHeE5HMEQzdUpNIn0.eyJleHAiOjE2MzQ4OTgyNTUsImlhdCI6MTYzNDg5MTA1NSwianRpIjoiOTU5NThhMDItZDI4Zi00NDhhLTk5NzItNDQ1YjA4NzBjMDBiIiwiaXNzIjoiaHR0cDovLzEwMC42NC44LjE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YXVkIjoiaHR0cDovLzEwMC42NC44LjE2MTo4MDgwL2F1dGgvcmVhbG1zL2R0Iiwic3ViIjoiNWMxMzMyN2EtYzNkZS00NDVmLTk4NGEtYTgwOWRmZWY4MWM2IiwidHlwIjoiUmVmcmVzaCIsImF6cCI6IkFwcF9jZThkYzYwMjM2OGJkY2U2OTI1M2MzYmQ5NzUxMjQzYSIsInNlc3Npb25fc3RhdGUiOiI2MjgxZWIxYS0xZTA4LTQ2YTMtYjU4Yy1hODMzODMxNTMxNmEiLCJzY29wZSI6IiJ9.sJ3VcgbavyT41OCc8xZ4sbAHliMOkXPYcvehIX_ttJE"
}
- 400
{
"code": 100106500,
"message": "request parameter error"
}
- 404: Not found.
Get Refresh Token on Client
Path
http://supOS ip:port/{basePath}/oauth2/client/v1/refreshToken
Query parameter
refreshToken: Refresh token.
Response
- 200: Successful.
{
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJwelhpeXRYVHZVVmx6YTloUC1tZTdEUXNLbXlvRkxLSmFHeE5HMEQzdUpNIn0.eyJleHAiOjE2MzQ4OTgyNTUsImlhdCI6MTYzNDg5MTA1NSwianRpIjoiOTU5NThhMDItZDI4Zi00NDhhLTk5NzItNDQ1YjA4NzBjMDBiIiwiaXNzIjoiaHR0cDovLzEwMC42NC44LjE2MTo4MDgwL2F1dGgvcmVhbG1zL2R0Iiwic3ViIjoiNWMxMzMyN2EtYzNkZS00NDVmLTk4NGEtYTgwOWRmZWY4MWM2IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiQXBwX2NlOGRjNjAyMzY4YmRjZTY5MjUzYzNiZDk3NTEyNDNhIiwic2Vzc2lvbl9zdGF0ZSI6IjYyODFlYjFhLTFlMDgtNDZhMy1iNThjLWE4MzM4MzE1MzE2YSIsImFjciI6IjEiLCJzY29wZSI6IiIsImNsaWVudElkIjoiQXBwX2NlOGRjNjAyMzY4YmRjZTY5MjUzYzNiZDk3NTEyNDNhIiwiY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