Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ If you have not already, Box prompt you to set up 2 factor authentication and Au

via the Box Application's Configuration page. **Make sure to reauthorize the application if you are modifying these settings**.

Download/store the configuration JSON somewhere on your computer. We will set the environment variable `BOX_JWT_CONFIG_PATH` to its location. We will also set the `BOX_USER_ID` to the user whose files we will be accessing. You can find your own Box User Id on your [account page](https://app.box.com/account).
Download/store the configuration JSON somewhere on your computer. We will set the environment variable `BOX_JWT_CONFIG_PATH` to its location. We will also set the `BOX_USER_ID` to the user whose files we will be accessing. You can find your own Box User Id on your [account page](https://app.box.com/account). You can also set the `BOX_JWT` environment variable to the JSON itself (as an alternative to the path).

#### Claude Desktop Configuration

Expand Down
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ if (process.env.BOX_DEV_TOKEN) {
const jwtAuth = new BoxJwtAuth({ config: jwtConfig });
const userAuth = jwtAuth.withUserSubject(process.env.BOX_USER_ID);
auth = userAuth;
} else if (process.env.BOX_JWT && process.env.BOX_USER_ID) {
const jwtConfig = JwtConfig.fromConfigJsonString(process.env.BOX_JWT);
const jwtAuth = new BoxJwtAuth({ config: jwtConfig });
const userAuth = jwtAuth.withUserSubject(process.env.BOX_USER_ID);
auth = userAuth;
} else {
throw new Error("BOX_DEV_TOKEN or BOX_JWT_CONFIG_PATH && BOX_USER_ID must be set as environment variable(s)");
throw new Error("BOX_DEV_TOKEN or BOX_USER_ID && (BOX_JWT || BOX_JWT_CONFIG_PATH) must be set as environment variable(s)");
}
const client = new BoxClient({ auth });

Expand Down
Loading