• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

"The provided token is malformed or otherwise invalid." error returned when using CreatePDFOperation

New Here ,
Oct 17, 2023 Oct 17, 2023

Copy link to clipboard

Copied

See the below exception details:


Exception Details: Adobe.PDFServicesSDK.exception.ServiceApiException: The provided token is malformed or otherwise invalid.

 

I've double-checked and the credentials are correct based on what was provided. What am I missing?

 

Code:

Credentials credentials = Credentials.ServicePrincipalCredentialsBuilder()
.WithClientId("*********************************")
.WithClientSecret("******************************")
.Build();

 

ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; 

//Create an ExecutionContext using credentials and create a new operation instance.
ExecutionContext executionContext = ExecutionContext.Create(credentials);
CreatePDFOperation createPdfOperation = CreatePDFOperation.CreateNew();

// Set operation input from a source file.
FileRef source = FileRef.CreateFromLocalFile(file);
createPdfOperation.SetInput(source);

// Execute the operation.
FileRef result = createPdfOperation.Execute(executionContext);

exported_filepath = Path.Combine(export_path, export_filename);
// Save the result to the specified location.
result.SaveAs(exported_filepath);

Views

136

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources