Hello.
I have ONLYOFFICE Workspace Community installed on Ubuntu 22.04 ( non docker )
How can i obtain the correct Bearer token so that i can use it in PUT,POST,GET methods? like this for example:
Let say i want to use Get a folder by ID method:
curl -L -X GET 'https://localhost:8092/api/2.0/files/:folderId' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <Authorization>' \
-d '{
"userIdOrGroupId": "string",
"filterType": 0,
"searchInContent": true,
"extension": "string",
"withSubfolders": true
}'
Then i need to replace <Authorization>
with Bearer LongTokenHere
I have tried this:
curl --request POST --header "Content-Type: application/json" --data "{\"username\":\"yourusername\",\"password\":\"yourpassword\"}" "https://yourportal.onlyoffice.com/api/2.0/authentication.json"
It works fine i get succesfully a output:
{"count":1,"status":0,"statusCode":201,"response":{"token":"\/N7U6BbkxqfSTehT6t2uPRSuyf+k2VSUjmEPhx3cQupzY17J8ctjem7P9pF9eU2wxqZNF\/nx\/j4sJnSnwgsM8seF5gQQ0RjkCTDleVLtcFTu8tpk4zqZExZw22H9nn2PpcrUCnMajPiKI5E\/TjnsnypAI9oHuW6\/an07ESNfY0I=","expires":"2026-06-21T03:16:34.6335590Z"}}
But when i use that token in the cURL method like this:
curl -L -X GET 'https://localhost:8092/api/2.0/files/:folderId' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer /N7U6BbkxqfSTehT6t2uPRSuyf+k2VSUjmEPhx3cQupzY17J8ctjem7P9pF9eU2wxqZNF\/nx\/j4sJnSnwgsM8seF5gQQ0RjkCTDleVLtcFTu8tpk4zqZExZw22H9nn2PpcrUCnMajPiKI5E\/TjnsnypAI9oHuW6\/an07ESNfY0I=' \
-d '{
"userIdOrGroupId": "string",
"filterType": 0,
"searchInContent": true,
"extension": "string",
"withSubfolders": true
}'
Then i am getting:
Unauthorized