From da0907d3c58b015f97ce678ec1fbf2132b285281 Mon Sep 17 00:00:00 2001 From: Reynaldi Chernando <12949382+reynaldichernando@users.noreply.github.com> Date: Fri, 6 Feb 2026 01:59:39 +0700 Subject: [PATCH] Document getAuthToken for web based login (#2418) --- src/docs/src/getting-started.md | 11 +++++++++++ src/docs/src/supported-platforms.md | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/docs/src/getting-started.md b/src/docs/src/getting-started.md index 3e0dd24f2..f04b7255c 100755 --- a/src/docs/src/getting-started.md +++ b/src/docs/src/getting-started.md @@ -35,6 +35,8 @@ puter.ai.chat(`Why did the chicken cross the road?`).then(console.log); #### Use in Node.js +Initialize Puter.js with your auth token using the `init` function: + ```js import { init } from "@heyputer/puter.js/src/init.cjs"; const puter = init(process.env.puterAuthToken); @@ -43,6 +45,15 @@ const puter = init(process.env.puterAuthToken); puter.ai.chat("What color was Napoleon's white horse?").then(console.log); ``` +If your environment has browser access, you can obtain a token via browser login: + +```js +import { init, getAuthToken } from "@heyputer/puter.js/src/init.cjs"; + +const authToken = await getAuthToken(); // performs browser based auth +const puter = init(authToken); +``` +
getAuthToken() to obtain a token via web-based login.