Add user to file

Only applicable to private files

Import the function at the top of your file

import { addUserToFile } from "swizzle-js";

Add a user to a file (allow them to access the file with their access token) by using addUserToFile(url, userId). Do not pass the signed URL to this function.

const success = await addUserToFile(url, uid)

The user can now access the file without you needing to user getFileUrl if they pass their access token via the Authorization header or as a query string parameter token=<access token>

Last updated