Core Auth Service

Authentication Service API (Private)

Base URI

http://api.lizks.io/v1/auth
API Methods
Token
POST /accessToken
POST /accessToken
POST /accessToken
POST /refreshToken
GET /infoToken
accessTokenAuthCode
POST /accessToken

Get Token dựa vào tham số Authorization Code được trả về từ hàm bước Authorization

Request parameters

grant_type
string required

Các giá trị của trường này nên là : authorization_code

code
string required

Mã uỷ quyền nhận được từ bước Authorization.

redirect_uri
string required

Giá trị đã thiết lập sẵn từ trước, cùng là giá trị ở bước Authorization

client_id
string required

Các “API Key” đã được cấu hình cho ứng dụng

client_secret
string required

“Secret Key” giá trị được cấu hình cho ứng dụng

Responses

200 OK
Body
Object
token_type
string
Example:
bearer
access_token
string
Example:
ab345cdef123ef1267890abcdef04567890abcd1
expires_in
string
Example:
86400
refresh_token
string
Example:
dfc337d39b0941650b67051a622885cb0eb67a51
401 Unauthorized

Invalid Tokens

Body
400 Bad Request

Khi authorization_code cung cấp không tồn tại hoặc đã hết hạn

Body

invalid_grant

503 Service Unavailable

Server không thể xử lý các yêu cầu tại thời điểm này đối với một số lý do. Thử lại sau.

Body
accessTokenPassword
POST /accessToken

Truy cập token dựa trên thông tin username, password

Request parameters

grant_type
string required

PHẢI là “password” trong trường hợp này.

client_id
string required
client_secret
string required
username
string required

Tài khoản đăng nhập của người dùng Lizks

password
string required

Mật khẩu người dung Lizks

scope
string optional

Responses

200 OK
Body
Object
token_type
string
Example:
bearer
access_token
string
Example:
ab345cdef123ef1267890abcdef04567890abcd1
expires_in
string
Example:
86400
refresh_token
string
Example:
dfc337d39b0941650b67051a622885cb0eb67a51
401 Unauthorized

Invalid Tokens

Body
400 Bad Request

Khi một hoặc nhiều tham số bắt buộc bị thiếu

Body
503 Service Unavailable

Server không thể xử lý các yêu cầu tại thời điểm này đối với một số lý do. Thử lại sau

Body
accessTokenClient
POST /accessToken

Có một số API không kết nối với bất kỳ người sử dụng nào. Đó là những nguồn lực thực hiện cho các khách hàng API (application). Những nguồn lực cần để xác định ứng dụng nào truy cập. Ví dụ :

  • Khi cần xác định ứng dụng của partner hay dev nào truy cập vào hệ thống.

Request parameters

grant_type
string required

PHẢI “client_credentials” trong trường hợp này.

client_id
string required
client_secret
string required

Responses

200 OK
Body
Object
token_type
string
Example:
bearer
access_token
string
Example:
ab345cdef123ef1267890abcdef04567890abcd1
expires_in
string
Example:
86400
refresh_token
string
Example:
dfc337d39b0941650b67051a622885cb0eb67a51
401 Unauthorized
Body
400 Bad Request

Khi một hoặc nhiều tham số bắt buộc bị thiếu

Body

Khi khách hàng gọi là mất tích, hoặc uỷ quyền yêu cầu khách hàng và mã thông báo yêu cầu khách hàng không phù hợp.

501 Not Implemented

Khi khách hàng yêu cầu một loại trợ cấp không được hỗ trợ, hiện chỉ có “authorization_code” được hỗ trợ, “client_credentials”, “refresh_token”, và “mật khẩu” các loại không.

Body

unsupported_grant_type

503 Service Unavailable

Server không thể xử lý các yêu cầu tại thời điểm này đối với một số lý do. Thử lại sau.

Body
refreshToken
POST /refreshToken

Request parameters

client_id
string required
client_secret
string required
refresh_token
string required

${refresh_token} - Mã refresh_token được tạo ra từ các bước accessToken trước đó.

grant_type
string required

“refresh_token” - giá trị bắt buộc

Responses

200 OK
Body
400 Bad Request
Body
501 Not Implemented

Invalid_grant

Body
503 Service Unavailable

Server_Error

Body
infoToken
GET /infoToken

Get thông tin authorized user

Request headers

Authorization
string required

Bearer ${access_token}

Responses

200 OK
Body
400 Bad Request
Body
501 Not Implemented
Body
503 Service Unavailable
Body
Authorization
GET /authorize
authorize
GET /authorize

Request parameters

response_type
string required

Giá trị của trường này nên là : code

client_id
string required

Các “API Key” giá trị được tạo ra khi đăng ký hoặc cấu hình trong ứng dụng của bạn.

redirect_uri
string required

URI người dùng sẽ được chuyển lại sau cấp phép. Giá trị này phải phù hợp với một trong những định nghĩa OAuth 2.0 Redirect URL trong của bạn cấu hình ứng dụng .

e.g. https://www.lizks.com/auth/example

state
string required

Một chuỗi giá trị đặc biệt khó đoán. Được sử dụng để ngăn chặn CSRF .

e.g. state=DCEeFWf45A53sdfKef424

scope
string optional

Một URL được mã hóa, giới hạn danh sách các quyền thành viên ứng dụng được yêu cầu thay mặt cho người sử dụng. Nếu không chỉ định một scope, hệ thống sử dụng các thiết lạp thành viên mặc định trong cấu hình ứng dụng .

e.g. scope=r_fullprofile%20r_emailaddress%20w_share

Responses

200 OK
401 Unauthorized

Giá trị state không hợp lệ :

Body
400 Bad Request
Body
501 Not Implemented
Body
503 Service Unavailable
Body
Users
GET /users/{user_id}
POST /users
PUT /users/{user_id}
DELETE /users/{user_id}
GET /users
Get User
GET /users/{user_id}

Path variables

user_id
string required

Request parameters

account_id
integer optional

Responses

200 OK
Body
Create User
POST /users
Update User
PUT /users/{user_id}

Path variables

user_id
string required

Request body

Delete User
DELETE /users/{user_id}

Path variables

user_id
string required
List User
GET /users

Responses

200 OK
Body
Array of UserInfo
Data Reference
TokenInfo
Object
token_type
string
Example:
bearer
access_token
string
Example:
ab345cdef123ef1267890abcdef04567890abcd1
expires_in
string
Example:
86400
refresh_token
string
Example:
dfc337d39b0941650b67051a622885cb0eb67a51
Methods: refreshToken
ErrorInfo
Object
error
string
Example:
ERROR_VALUE
error_description
string
Example:
ERROR_MESSAGE
AuthInfo
Object
account
Object
email
string
Example:
alice@example.com
clientId
string
Example:
alice_client_id2
redirectUri
unknown
Methods: infoToken
UserInfo
Object
id
integer
name
string
status
string
created_at
string date
updated_at
string date