feat: Ability to access user tokens via Platform API (#11537)
- Add Platform API for generating user tokens - Add the swagger documentation. --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
@@ -64,6 +64,11 @@
|
||||
- $ref: '#/parameters/platform_user_id'
|
||||
get:
|
||||
$ref: './platform/users/login.yml'
|
||||
/platform/api/v1/users/{id}/token:
|
||||
parameters:
|
||||
- $ref: '#/parameters/platform_user_id'
|
||||
post:
|
||||
$ref: './platform/users/token.yml'
|
||||
|
||||
|
||||
# ---------------- end of platform path -----------#
|
||||
|
||||
42
swagger/paths/platform/users/token.yml
Normal file
42
swagger/paths/platform/users/token.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
tags:
|
||||
- Users
|
||||
operationId: post-user-token
|
||||
summary: Get User Access Token
|
||||
description: Get the access token of a user
|
||||
security:
|
||||
- platformAppApiKey: []
|
||||
responses:
|
||||
200:
|
||||
description: Success
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
access_token:
|
||||
type: string
|
||||
description: Access token of the user
|
||||
expiry:
|
||||
type: [integer, "null"]
|
||||
description: Expiry timestamp
|
||||
user:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: User ID
|
||||
name:
|
||||
type: string
|
||||
description: User's full name
|
||||
display_name:
|
||||
type: string
|
||||
description: User's display name
|
||||
email:
|
||||
type: string
|
||||
description: User's email address
|
||||
pubsub_token:
|
||||
type: string
|
||||
description: User's pubsub token
|
||||
401:
|
||||
description: Unauthorized
|
||||
404:
|
||||
description: The given user does not exist
|
||||
|
||||
@@ -655,6 +655,78 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/platform/api/v1/users/{id}/token": {
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/parameters/platform_user_id"
|
||||
}
|
||||
],
|
||||
"post": {
|
||||
"tags": [
|
||||
"Users"
|
||||
],
|
||||
"operationId": "post-user-token",
|
||||
"summary": "Get User Access Token",
|
||||
"description": "Get the access token of a user",
|
||||
"security": [
|
||||
{
|
||||
"platformAppApiKey": []
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_token": {
|
||||
"type": "string",
|
||||
"description": "Access token of the user"
|
||||
},
|
||||
"expiry": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"description": "Expiry timestamp"
|
||||
},
|
||||
"user": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"description": "User ID"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "User's full name"
|
||||
},
|
||||
"display_name": {
|
||||
"type": "string",
|
||||
"description": "User's display name"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"description": "User's email address"
|
||||
},
|
||||
"pubsub_token": {
|
||||
"type": "string",
|
||||
"description": "User's pubsub token"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
},
|
||||
"404": {
|
||||
"description": "The given user does not exist"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/public/api/v1/inboxes/{inbox_identifier}": {
|
||||
"parameters": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user