0

I'm working on a APS Revit Design Automation app. I've submitted the work item and it has completed running the add-in bundle and generated an outputFile. However, when it comes to the step of uploading the result to a bucket, it fails.

When I define the output file argument as

var outputFileArgument = new XrefTreeArgument()
        {
            Url = $"urn:adsk.objects:os.object:{bucketKey}/{resultKey}",
            Headers = new()
            {
                { "Authorization", "Bearer " + token}
            },
            Verb = Verb.Put
        };

bucketKey - is valid, because the input file works resultKey - I've tried using the same filename as generated from the bundle and a unique filename as well

I'm getting this error:

Uploading 'T:\Aces\Jobs\266b6d812dd04a33b17efd72b054e31e\outputFile.rvt': verb - 'Put', url - 'urn:adsk.objects:os.object:ha.../outputFile.rvt'
[08/11/2025 21:10:55] Error: Unable to upload file to 'urn:adsk.objects:os.object:hat...-designautomation/outputFile.rvt': Fail to upload to OSS: BucketName-'hatso....-designautomation', ObjectKey-'outputFile.rvt', Error-'IDX12709: CanReadToken() returned false. JWT is not well formed.
The token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EncodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'.'.
[08/11/2025 21:10:55] Error: Upload failed. Reason = Fail to upload to OSS: BucketName-'hatso47j...eobx-designautomation', ObjectKey-'outputFile.rvt', Error-'IDX12709: CanReadToken() returned false. JWT is not well formed.

I've also tried to use this endpoint https://developer.api.autodesk.com/oss/v2/buckets/{bucketKey}/objects/{resultKey}/signeds3download

To generate the output URL, but this gives me "SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided" error

1
  • I've solved this by using the ObjectsApi to generate a signed URL and removed the authorization header from the request. ``` ObjectsApi objectsApi = new ObjectsApi(new ClientCredentials(_clientId, _clientSecret)); var resource = await _ossClient.CreateSignedResourceAsync(bucketKey, resultKey, new CreateSignedResource(), Access.ReadWrite, true, accessToken: token.AccessToken) ;``` Commented Aug 12 at 2:58

2 Answers 2

0

I've solved this by using the ObjectsApi to generate a signed URL and removing the authorisation header from the request.

        ObjectsApi objectsApi = new ObjectsApi(new ClientCredentials(_clientId, _clientSecret));

        var resource = await _ossClient.CreateSignedResourceAsync(bucketKey,
            resultKey,
            new CreateSignedResource(),
            Access.ReadWrite,
            true, accessToken: token.AccessToken);
        
        var outputFileArgument = new XrefTreeArgument()
        {
            Url = resource.SignedUrl,
            Verb = Verb.Put
        };
Sign up to request clarification or add additional context in comments.

Comments

0

You can cross check the token at JWT (https://www.jwt.io/), the oAuth token should be valid.
For example.

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.