About SDK Authentication Errors

0
Hi, there I am using SDK to create tools. However, when I run it, it returns error code 401. Please let me know how to solve this problem.   --------------error message-------------- Creating temporary working copy for branch 'main'...Error: Request failed, POST '/v1/temporary-working-copies/' message: Response code 401 (Unauthorized)    at createInformativeError (C:\SdkTools\node_modules\src\utils\RestConnector.ts:225:26)    at doRequest (C:\SdkTools\node_modules\src\utils\RestConnector.ts:212:15)    at processTicksAndRejections (node:internal/process/task_queues:105:5)    at async RestConnector.awaitTask (C:\SdkTools\node_modules\src\utils\RestConnector.ts:131:24)    at async workingCopyId.maxAttempts (C:\SdkTools\node_modules\src\clients\RepositoriesClient.ts:42:34)    at async retry (C:\SdkTools\node_modules\src\utils\retry.ts:21:20)    at async RepositoriesClient.createTemporaryWorkingCopy (C:\SdkTools\node_modules\src\clients\RepositoriesClient.ts:40:31)    at async App.createTemporaryWorkingCopy (C:\SdkTools\node_modules\src\object-api\App.ts:39:31)    at async main (C:\SdkTools\script.ts:18:25) {  responseData: '{"errorCode":"RS401","errorMessage":"You need to authenticate to be able to execute this request."}',  responseStatus: 401}
asked
1 answers
0

Ensure your Mendix SDK and dependencies are updated to the latest version

npm update mendix-sdk

 

In your SDK script, confirm you’ve added the API key to the SdkClient initialization:

const client = new MendixSdkClient('username', 'apikey');

 

answered