Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 507 Bytes

README.md

File metadata and controls

18 lines (13 loc) · 507 Bytes

React authenticated iframe

React authenticated iframe is a component that can be used if you want to create an iframe, but the resource to be fetched requires token authentication.

Usage

This is an example to open an <iframe> with a PDF file behind an authenticated API.

import AuthIFrame from "react-auth-iframe";

const MyComponent = () => <div>
    <AuthIFrame
        src="https://api.my-domain.com/files/document.pdf"
        token={token}
        type="application/pdf" />
</div>