Skip to main content
Participant
November 17, 2022
Question

Getting "The provided token is malformed or otherwise invalid"

  • November 17, 2022
  • 1 reply
  • 839 views

I followed the .Net example for "ExportPdfToDocx" using the Adobe.PDFServiceSDK. 

It throw the "The provided token is malformed or otherwise invalid" when calling exportPdfOperation.Excute(executionContext).

 

Code snipple:

Credentials credentials = Credentials.ServiceAccountCredentialsBuilder()
                            .FromFile(@"..\pdfservices-api-credentials.json")
                            .Build();

            //Create an ExecutionContext using credentials and create a new operation instance.
            ExecutionContext executionContext = ExecutionContext.Create(credentials);
            ExportPDFOperation exportPdfOperation = ExportPDFOperation.CreateNew(ExportPDFTargetFormat.DOCX);

            // Set operation input from a local PDF file
            FileRef sourceFileRef = FileRef.CreateFromLocalFile(inputFile);
            exportPdfOperation.SetInput(sourceFileRef);

            // Execute the operation.
            ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
            FileRef result = exportPdfOperation.Execute(executionContext);

            // Save the result to the specified location.
            result.SaveAs(newFile);

Anyone encounter this and have solution?

This topic has been closed for replies.

1 reply

Participant
February 1, 2023

I have the same problem. I also follow the examples and gets "The provided token is malformed or otherwise invalid" when calling exportPdfOperation.Excute(executionContext). Anyone have a solution for this? Is seems that the token field is null in executionContext.. I have double checked all the credential values.