Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
How to render file in react-doc-viewer from a secure API endpoint in Next.Js or ReactJs?

I want to render files in my Next.JS web application from a secure API. The API returns the the following data

    {
        "name": "Test1.docx",
        "contentUri": "https://api.mypurecloud.ie/api/v2/downloads/xxx",
        "contentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    }

I am using the react-doc-viewer NPM package. There is no issue with rendering unsecured files. Can anyone show me how to pass the authentication token to the API call with this package?

OR Is there any other way to render the files in the browser without having to download them on the client machine?

My code is

export default function Home() {
  const docs = [
    { uri: '/test.pdf' }, // Local File
    { uri: 'https://url-to-my-pdf.pdf' }, // secure remote File
  ];

  return (
    <div className={styles.container}>
      <Head>
        <title>Create Next App</title>
        <meta name="description" content="Generated by create next app" />
        <link rel="icon" href="/favicon.ico" />
      </Head>

      <main>
        <h1 className={styles.title}>Document Viewer</h1>
        <DocViewer pluginRenderers={DocViewerRenderers} documents={docs} />
      </main>
    </div>
  );
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!