![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@flatfile/sdk
Advanced tools
npm install @flatfile/sdk --save
flatfileImporter(**token**
)
(GitHub)
const importer = flatfileImporter("<%= token %>");
Name | Type |
---|---|
token | string |
The token
parameter is a JSON Web Token (JWT) generated for a given end user. The JWT should be generated on the application server to prevent dissemination of your private key. The JWT is signed using the the Embed ID of the Flatfile embed (created on the dashboard), the Private Key (also provided on the dashboard, but only available once during the creation of the embed), and an identifier for the end user (an email or other ID).
// Example token generation in Node.js:
const jwt = require("jsonwebtoken");
const EMBED_ID = "YOUR_EMBED_ID";
const PRIVATE_KEY = "YOUR_PRIVATE_KEY";
const token = await jwt.sign(
{
embed: EMBED_ID,
sub: currentUser.email, // a unique identifier such as an id or email
},
PRIVATE_KEY
);
Note: The below snippet is for testing purposes only. This is not safe to use in your production application, but can be useful when testing out for the first time.
// Example token generation in the browser *unsafe*
import { flatfileImporter } from "@flatfile/sdk";
const importer = flatfileImporter("");
await importer.__unsafeGenerateToken({
privateKey: "YOUR_PRIVATE_KEY",
embedId: "YOUR_EMBED_ID",
endUserEmail: "max@mail.com",
});
importer.launch();
The sub
field is unique to each end user. This unique identification allows Flatfile to continue an import after an interruption and reduce upload abandonment. For more information on this unique identifier.
Launches the Flatfile Importer inside of an iFrame by calling openInIframe
(GitHub).
await importer.launch();
Destroys the flatfileImporter.
The following events will be emitted to the client.
Returns a batchId
unique to the end user the token was generated for. This allows uploads to be continued after an interruption (such as a user closing a browser tab) and can be used to request data from the Flatfile API.
importer.on('init', ({ batchId }) => {
console.log(`Batch ${batchId} has been initialized.`)
})
Returns the same batchId
generated during initialization (see above) that is unique to the end user the token was generated for. This allows uploads to be continued after an interruption (such as a user closing a browser tab) and can be used to request data from the Flatfile API.
importer.on("launch", ({ batchId }) => {
console.log(`Batch ${batchId} has been launched.`);
});
Returns a JavaScript error object.
importer.on("error", (error) => {
console.error(error);
});
Returns a payload with a copy of the validated data from the upload.
importer.on("complete", async (payload) => {
console.log(JSON.stringify(await payload.data(), null, 4));
});
FAQs
Flatfile SDK
The npm package @flatfile/sdk receives a total of 5,259 weekly downloads. As such, @flatfile/sdk popularity was classified as popular.
We found that @flatfile/sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 26 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.