Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to send api key for multiple apis?

Mansi Gusain
Contributor
February 20, 2025

Hi , I am using two apis- /spaces and /pages in the same schema for enabling actions for agent. Both are on same server and use same authentication token. I am unable to use the actions together but individually they work great and as expected. I am facing issue with the passing of token. 

 

 

This is the schema: 

 

openapi: 3.1.0 info: title: Custom Atlassian API version: 1.0.0 servers: - url: https://name.atlassian.net description: Custom Atlassian server paths: /wiki/api/v2/spaces: get: operationId: getSpacesId summary: Retrieve space information description: Get the ID of a space filtered by keys. parameters: - in: query name: keys required: true description: Keys to filter spaces by. schema: type: string security: - basicAuth: [] responses: '200': description: The space ID. content: application/json: schema: type: object properties: id: type: string description: The ID of the space. /wiki/api/v2/pages: post: operationId: createPage summary: Create a new page description: Create a new page in a specified space. requestBody: required: true content: application/json: schema: type: object properties: spaceId: type: string description: The ID of the space. status: type: string enum: [current] description: The status of the page. title: type: string description: The title of the page. body: type: object properties: representation: type: string enum: [storage] description: The format of the body. value: type: string description: The content of the page. security: - basicAuth: [] responses: '201': description: The page was created successfully. components: securitySchemes: basicAuth: type: http scheme: basic

 

 

When I pass the email:token it fails with this log -

 

2025-02-21T07:39:20.649193696Z {"level":"error","message":"[handleAbortError] AI response error; aborting request: algorithm.iv must contain exactly 16 bytes","stack":"OperationError: algorithm.iv must contain exactly 16 bytes\n at validateByteLength (node:internal/crypto/util:440:11)\n at asyncAesCbcCipher (node:internal/crypto/aes:134:3)\n at Object.aesCipher (node:internal/crypto/aes:210:28)\n at cipherOrWrap...","timestamp":"2025-02-21T07:39:20.649Z"}

 

 

 

To handle this I encoded it to base64 but then actions to get and create do not get authenticated. 

The issue is related to key only. Please help. 

 

1 answer

0 votes
Humashankar VJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 28, 2025

Hi @Mansi Gusain 

Manually testing the API endpoints can help separate the issue.

If the request is successful, it suggests that the problem lies in how the authentication is being passed programmatically, rather than with the API credentials themselves.

This can help you focus your troubleshooting efforts on the code.

-------------------------------------------------------------------------

curl -X GET "https://name.atlassian.net/wiki/api/v2/spaces?keys=your_key" \

     -H "Authorization: Basic $(echo -n 'email@example.com:your_api_token' | base64)" \

     -H "Content-Type: application/json"

 

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

 

Mansi Gusain
Contributor
March 2, 2025

Hi thanks for replying, yeah I too believe it was the passing of the credentials. The way they can be passed. Do not know the way that can be done, in which format can i pass the key because if i am encrypting the keys then at the authentication level that is causing problem . 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events