{"_id":"@connectstrata/strata-frontend-sdk","_rev":"7-8da75df3b12dded448c78fd4ed4e4536","name":"@connectstrata/strata-frontend-sdk","dist-tags":{"latest":"2.1.0"},"versions":{"1.0.0":{"name":"@connectstrata/strata-frontend-sdk","version":"1.0.0","keywords":["strata","oauth","authentication","sdk"],"author":{"name":"Strata"},"license":"MIT","_id":"@connectstrata/strata-frontend-sdk@1.0.0","maintainers":[{"name":"julian-strata","email":"julian@connectstrata.com"},{"name":"ilya.strata","email":"ilya@connectstrata.com"}],"homepage":"https://github.com/connectstrata/strata-frontend-sdk#readme","bugs":{"url":"https://github.com/connectstrata/strata-frontend-sdk/issues"},"dist":{"shasum":"0faba85a716ee74e9d11073df0a7674847d0d0e9","tarball":"https://registry.npmjs.org/@connectstrata/strata-frontend-sdk/-/strata-frontend-sdk-1.0.0.tgz","fileCount":11,"integrity":"sha512-zLb2MhY6ZwB665hKzAbPmrBIpYliuZw5LwB5KeNlm4j1d+yUJyVTJFA/po5fgW3JJ9jeraeAmhItlh55+8BIDw==","signatures":[{"sig":"MEUCIQCrGqQuChbiPNxx2hEEwQBKwXrePxBFwAfQVvPUEFcyngIgd11wHfE+H/ti9TwUFhGQSHvfBGwJcuqACnU47r2heJ0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26346},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","public":true,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"461250030c0cfb9cc195317bcf581cdd31adfadb","scripts":{"test":"echo 'No tests configured yet'","build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"_npmUser":{"name":"julian-strata","email":"julian@connectstrata.com"},"repository":{"url":"git+https://github.com/connectstrata/strata-frontend-sdk.git","type":"git"},"_npmVersion":"10.1.0","description":"Frontend sdk for simplifying integration auth","directories":{},"sideEffects":false,"_nodeVersion":"20.9.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/strata-frontend-sdk_1.0.0_1750130430364_0.6252134113946513","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@connectstrata/strata-frontend-sdk","version":"1.1.0","keywords":["strata","oauth","authentication","sdk"],"author":{"name":"Strata"},"license":"MIT","_id":"@connectstrata/strata-frontend-sdk@1.1.0","maintainers":[{"name":"julian-strata","email":"julian@connectstrata.com"},{"name":"ilya.strata","email":"ilya@connectstrata.com"}],"homepage":"https://github.com/connectstrata/strata-frontend-sdk#readme","bugs":{"url":"https://github.com/connectstrata/strata-frontend-sdk/issues"},"dist":{"shasum":"c50f5f4a99b9f357d30b37414ebb573219b73f74","tarball":"https://registry.npmjs.org/@connectstrata/strata-frontend-sdk/-/strata-frontend-sdk-1.1.0.tgz","fileCount":11,"integrity":"sha512-GuOw8HwsFlPhQ84S+gwXVUOfuuLfJZhduCsQ8eMM3Tm5jvvuY0U4xwBpdXmCdzpLHx7CztYryFB3V2lVUQve2w==","signatures":[{"sig":"MEQCIFBaZegALLZXoQcJ4kBJutKPJIf/TzOXtNPA/WxhEf2OAiA/3JTOlHDTAERnU9IsQEV+zwY5gXTdWHbdYwrN+pH4IA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26346},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","public":true,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"dd35918c946bc43c30a05c6716be8d645ce83a88","scripts":{"test":"echo 'No tests configured yet'","build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"_npmUser":{"name":"julian-strata","email":"julian@connectstrata.com"},"repository":{"url":"git+https://github.com/connectstrata/strata-frontend-sdk.git","type":"git"},"_npmVersion":"10.1.0","description":"Frontend sdk for simplifying integration auth","directories":{},"sideEffects":false,"_nodeVersion":"20.9.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/strata-frontend-sdk_1.1.0_1757339723412_0.8983381429140096","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@connectstrata/strata-frontend-sdk","version":"1.1.1","keywords":["strata","oauth","authentication","sdk"],"author":{"name":"Strata"},"license":"MIT","_id":"@connectstrata/strata-frontend-sdk@1.1.1","maintainers":[{"name":"julian-strata","email":"julian@connectstrata.com"},{"name":"ilya.strata","email":"ilya@connectstrata.com"}],"homepage":"https://github.com/connectstrata/strata-frontend-sdk#readme","bugs":{"url":"https://github.com/connectstrata/strata-frontend-sdk/issues"},"dist":{"shasum":"26a46467ac2659e825da60b0bec40753e8dc1832","tarball":"https://registry.npmjs.org/@connectstrata/strata-frontend-sdk/-/strata-frontend-sdk-1.1.1.tgz","fileCount":11,"integrity":"sha512-kBYprlJLrZm48gZKKOL+moKeJED71J0NkzmIszrxbab+bvxuTEjjJjBZIfa6/MxSZuvtKgx4rvv++5miK+xxRA==","signatures":[{"sig":"MEYCIQCOAMyCRhyZYz3HnWw3bwNi2l4NgZQgiv0a09wJuPNaZQIhAJZQqRRX0fWnIGefnPz4rnZ0kheRMVDUQGY7oiKCL8eA","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26334},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","public":true,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"f4b6ab3660ac8d94be33f366e479dbb775a480dc","scripts":{"test":"echo 'No tests configured yet'","build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"_npmUser":{"name":"julian-strata","email":"julian@connectstrata.com"},"repository":{"url":"git+https://github.com/connectstrata/strata-frontend-sdk.git","type":"git"},"_npmVersion":"10.1.0","description":"Frontend sdk for simplifying integration auth","directories":{},"sideEffects":false,"_nodeVersion":"20.9.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/strata-frontend-sdk_1.1.1_1762439786029_0.009671830110032031","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@connectstrata/strata-frontend-sdk","version":"1.2.0","keywords":["strata","oauth","authentication","sdk"],"author":{"name":"Strata"},"license":"MIT","_id":"@connectstrata/strata-frontend-sdk@1.2.0","maintainers":[{"name":"julian-strata","email":"julian@connectstrata.com"},{"name":"ilya.strata","email":"ilya@connectstrata.com"}],"homepage":"https://github.com/connectstrata/strata-frontend-sdk#readme","bugs":{"url":"https://github.com/connectstrata/strata-frontend-sdk/issues"},"dist":{"shasum":"225f7cfb2fd4bd017aebe4ee76ea3a6a65325ce1","tarball":"https://registry.npmjs.org/@connectstrata/strata-frontend-sdk/-/strata-frontend-sdk-1.2.0.tgz","fileCount":11,"integrity":"sha512-AHNwwssB8Zu2avZ+h1nUBJGj2mdzUKMufnITBEbahZ2whWSqTr2fPOAQ9mHBPPE8wqsVSeKEe8nbQTZmv+BL0Q==","signatures":[{"sig":"MEUCIQCtwIlQZEqL7iKRPLRY6SE6Zsdr8PF/cRV91lMVh3LbgwIgSMWHS3qrl/f4aMahsYCWDRjmrUj159lKI1ZqdSpPuZg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28534},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","public":true,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"15c1b3597021bfb688c1d6fbc9b24f060cdba325","scripts":{"test":"echo 'No tests configured yet'","build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"_npmUser":{"name":"julian-strata","email":"julian@connectstrata.com"},"repository":{"url":"git+https://github.com/connectstrata/strata-frontend-sdk.git","type":"git"},"_npmVersion":"10.9.3","description":"Frontend sdk for simplifying integration auth","directories":{},"sideEffects":false,"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/strata-frontend-sdk_1.2.0_1762810842899_0.8536203281653838","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@connectstrata/strata-frontend-sdk","version":"1.3.0","keywords":["strata","oauth","authentication","sdk"],"author":{"name":"Strata"},"license":"MIT","_id":"@connectstrata/strata-frontend-sdk@1.3.0","maintainers":[{"name":"julian-strata","email":"julian@connectstrata.com"},{"name":"ilya.strata","email":"ilya@connectstrata.com"}],"homepage":"https://github.com/connectstrata/strata-frontend-sdk#readme","bugs":{"url":"https://github.com/connectstrata/strata-frontend-sdk/issues"},"dist":{"shasum":"a538539ff31801904bb3c8fe7bfab72d3673d744","tarball":"https://registry.npmjs.org/@connectstrata/strata-frontend-sdk/-/strata-frontend-sdk-1.3.0.tgz","fileCount":11,"integrity":"sha512-qQ94JstjjyQmE0cOCayRKNSeIEVCwYAENbcr9hkrf2xQ8ZsdyX119qEx3xIoKdpmtyalE1Fo31yGDv331kHQWA==","signatures":[{"sig":"MEQCIFLcb0xMvT90R221qIFMa292vpJ3a6N4NaxIjPeVSeFpAiAGS7qwgfdDOdEJ1AIvOnUXXv871bztsYaTDIiExnRmYQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31564},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","public":true,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"69fff8d11efba0d60018abca0b4e5b51991c17dd","scripts":{"test":"echo 'No tests configured yet'","build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"_npmUser":{"name":"julian-strata","email":"julian@connectstrata.com"},"repository":{"url":"git+https://github.com/connectstrata/strata-frontend-sdk.git","type":"git"},"_npmVersion":"10.9.3","description":"Frontend sdk for simplifying integration auth","directories":{},"sideEffects":false,"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/strata-frontend-sdk_1.3.0_1764107530366_0.40680838185306034","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@connectstrata/strata-frontend-sdk","version":"2.0.0","keywords":["strata","oauth","authentication","sdk"],"author":{"name":"Strata"},"license":"MIT","_id":"@connectstrata/strata-frontend-sdk@2.0.0","maintainers":[{"name":"julian-strata","email":"julian@connectstrata.com"},{"name":"ilya.strata","email":"ilya@connectstrata.com"}],"homepage":"https://github.com/connectstrata/strata-frontend-sdk#readme","bugs":{"url":"https://github.com/connectstrata/strata-frontend-sdk/issues"},"dist":{"shasum":"fec68ae38f6bc4a9508498772e31a3264662fbc9","tarball":"https://registry.npmjs.org/@connectstrata/strata-frontend-sdk/-/strata-frontend-sdk-2.0.0.tgz","fileCount":11,"integrity":"sha512-BcWCqDzcakY0vzRqY72MdTzyrrKCjwPqLTAJhJUTq/WDJDOYRXZJpEzcsS9XjG3dtQBgKMX9eCjcaHpeiMtEqw==","signatures":[{"sig":"MEYCIQCEsZM2OFY4vlGskquMCFxr+n7ETIkdvd8RiuJaByjubwIhAOId1/AtJ09IOiYuTJoeE9bwehnQXynsbl4sGqA86Hl+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31821},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","public":true,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"8b7842d4cc5dcd101bda8b23c654ea83168187ba","scripts":{"test":"echo 'No tests configured yet'","build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"_npmUser":{"name":"julian-strata","email":"julian@connectstrata.com"},"repository":{"url":"git+https://github.com/connectstrata/strata-frontend-sdk.git","type":"git"},"_npmVersion":"10.9.3","description":"Frontend sdk for simplifying integration auth","directories":{},"sideEffects":false,"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"devDependencies":{"tslib":"^2.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/strata-frontend-sdk_2.0.0_1764784634263_0.39876432238416104","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@connectstrata/strata-frontend-sdk","version":"2.1.0","description":"Frontend sdk for simplifying integration auth","type":"module","sideEffects":false,"public":true,"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist","test":"echo 'No tests configured yet'","lint":"eslint .","format":"prettier --write .","lint:format":"npm run lint && npm run format"},"repository":{"type":"git","url":"git+https://github.com/connectstrata/strata-frontend-sdk.git"},"keywords":["strata","oauth","authentication","sdk"],"author":{"name":"Strata"},"license":"MIT","bugs":{"url":"https://github.com/connectstrata/strata-frontend-sdk/issues"},"homepage":"https://github.com/connectstrata/strata-frontend-sdk#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^8.50.0","@typescript-eslint/parser":"^8.50.0","eslint":"^9.39.2","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","globals":"^16.5.0","jiti":"^2.6.1","prettier":"^3.7.4","tslib":"^2.0.0","typescript":"^5.0.0","typescript-eslint":"^8.50.0"},"_id":"@connectstrata/strata-frontend-sdk@2.1.0","gitHead":"c83b276cb125fc6ca9d8c82f75e5a679bf0993e5","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-RQt+j0n/YZypLPReO5MaRkDhhWoayXu5rCEVZcjCkhV0tFNfEZ2Bofes6IphKDEREWIDg66Y0yBnuhpt4+jbhw==","shasum":"e0e1f7394b1a36b06b028e098904df2a72734670","tarball":"https://registry.npmjs.org/@connectstrata/strata-frontend-sdk/-/strata-frontend-sdk-2.1.0.tgz","fileCount":11,"unpackedSize":34031,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEXk3wkGs/7xwYcwStu0npVgjaYcUDrwgF3X/pg4sL70AiAlYovhANjCkgT7harZsFSIlzqypDsfwoo7D4xPTFIW0g=="}]},"_npmUser":{"name":"julian-strata","email":"julian@connectstrata.com"},"directories":{},"maintainers":[{"name":"julian-strata","email":"julian@connectstrata.com"},{"name":"ilya.strata","email":"ilya@connectstrata.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/strata-frontend-sdk_2.1.0_1765993210618_0.3645257824745767"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-17T03:20:30.270Z","modified":"2025-12-17T17:40:10.979Z","1.0.0":"2025-06-17T03:20:30.565Z","1.1.0":"2025-09-08T13:55:23.594Z","1.1.1":"2025-11-06T14:36:26.219Z","1.2.0":"2025-11-10T21:40:43.122Z","1.3.0":"2025-11-25T21:52:10.591Z","2.0.0":"2025-12-03T17:57:14.495Z","2.1.0":"2025-12-17T17:40:10.758Z"},"bugs":{"url":"https://github.com/connectstrata/strata-frontend-sdk/issues"},"author":{"name":"Strata"},"license":"MIT","homepage":"https://github.com/connectstrata/strata-frontend-sdk#readme","keywords":["strata","oauth","authentication","sdk"],"repository":{"type":"git","url":"git+https://github.com/connectstrata/strata-frontend-sdk.git"},"description":"Frontend sdk for simplifying integration auth","maintainers":[{"name":"julian-strata","email":"julian@connectstrata.com"},{"name":"ilya.strata","email":"ilya@connectstrata.com"}],"readme":"# strata-frontend-sdk\n\n### Installing from npm\n\nInstall the frontend SDK with your favorite package manager:\n\n```bash\n$ npm install @connectstrata/strata-frontend-sdk\n```\n\n### Setup\n\n#### 1. Generate a signing key in the Strata dashboard\n\nIn the Strata dashboard, navigate to the [Settings](https://app.connectstrata.com/settings) page by selecting `Settings` in the sidebar. Click `Generate New Keypair` to get a new signing key. Save the private key somewhere secure. You will not be able to see it again.\n\n#### 2. Create signed user JWT tokens in your app backend\n\n**In your app backend**, generate a user [JWT](https://jwt.io/) token for each user and make it available to the frontend. If your frontend is a client-side javascript application, this likely means creating an API endpoint that the frontend can use to fetch a user JWT token. Never expose the signing key directly to the frontend.\n\nUse the following JWT header claims:\n\n- alg: The algorithm used to sign the JWT. Must be `RS256`.\n- typ: The type of token. Must be `JWT`.\n\n```json\n{\n  \"alg\": \"RS256\",\n  \"typ\": \"JWT\"\n}\n```\n\nUse the following JWT payload claims `sub`, `iat`, `exp`, `project_id`.\n\n- project_id: Your Strata project ID. This can be found on the [Settings](https://app.connectstrata.com/settings) page\n- sub: The JWT subject. This is your primary identifier for the user.\n- iat: The JWT issued at timestamp in seconds since the Unix epoch. Typically the current time.\n- exp: The JWT expiration timestamp in seconds since the Unix epoch (must be later than the iat claim).\n\n```json\n{\n  \"project_id\": \"your_project_id\",\n  \"sub\": \"user_or_company_id\",\n  \"iat\": 1749602274,\n  \"exp\": 1749602290\n}\n```\n\nYou can optionally include an `external_id` claim. If provided, it will be used as the user / company identifier and takes precedence over the `sub` claim.\n\nHere is a sample implementation with a Next.js API endpoint:\n\n```typescript\nimport { NextResponse } from \"next/server\";\nimport jwt from \"jsonwebtoken\";\n\n/*\n * Generates a user JWT token for the Strata SDK\n */\nexport async function POST() {\n  const projectId = process.env.STRATA_PROJECT_ID;\n  const currentTime = Math.floor(Date.now() / 1000);\n  const payload: jwt.JwtPayload = {\n    sub: \"user_or_company_id\",\n    project_id: process.env.STRATA_PROJECT_ID,\n    iat: currentTime,\n  };\n\n  const privateKey = process.env.PRIVATE_KEY;\n  const token = jwt.sign(payload, privateKey, {\n    algorithm: \"RS256\",\n    expiresIn: \"1h\",\n  });\n\n  return NextResponse.json({ token });\n}\n```\n\n### 3. Prompt a user to authorize your integration\n\nTo start the authorization flow for your integration, call `strata.authorize` with a signed user jwt. The function call returns a `Promise` that resolves when the user successfully completes the auth flow. It fails with an error if the authorization fails or the user closes the window without authorizing your app.\n\n```typescript\nimport Strata from \"@connectstrata/strata-frontend-sdk\";\n\nconst strata = new Strata();\n\nstrata.authorize(jwtToken, \"slack\");\n```\n\nSome integrations require additional parameters. For example, Shopfiy requires the merchant's shop subdomain. You can provide additional custom parameters to the authorize call:\n\n```typescript\nstrata.authorize(jwtToken, \"shopify\", {\n  customParams: {\n    shop: \"connectstrata.myshopify.com\",\n  },\n});\n```\n","readmeFilename":"README.md"}