{"_id":"@aurum-v2/oauth-v2","_rev":"4-8e93d654cbabaf4ea5c56d2d26fbc494","name":"@aurum-v2/oauth-v2","dist-tags":{"latest":"0.1.10"},"versions":{"0.1.7":{"name":"@aurum-v2/oauth-v2","version":"0.1.7","keywords":["aurum","oauth","pkce","react","sso"],"license":"UNLICENSED","_id":"@aurum-v2/oauth-v2@0.1.7","maintainers":[{"name":"aurum-v2","email":"no-reply@aurumplatform.io"}],"homepage":"https://github.com/aurum-v2/aurum-ouath-v2#readme","bugs":{"url":"https://github.com/aurum-v2/aurum-ouath-v2/issues"},"dist":{"shasum":"cd517bba87370cfbb9ddbf92a44ca3514bc2a8d4","tarball":"https://registry.npmjs.org/@aurum-v2/oauth-v2/-/oauth-v2-0.1.7.tgz","fileCount":62,"integrity":"sha512-lxx3C7BDiR/WPUurHJDBgtjujaSglEHPM7tcGLeKkODif+A9+Al460xg1oMl/47OSjIyCzs73J1OcG7xPrbqWg==","signatures":[{"sig":"MEYCIQCBb9uEUivctGJV/aBKLjSLByTYKEBD1K1jhm7hnk+KUAIhAI0CRnY5a1nU/V4d40cUlPak2+B6qSvy2XVzX8QHngSa","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":141415},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./react":{"types":"./dist/react/index.d.ts","import":"./dist/react/index.js"}},"gitHead":"9a2f98b992aa26eb73e7cdb74fa7d1c820b56865","private":false,"scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"aurum-v2","email":"no-reply@aurumplatform.io"},"repository":{"url":"git+https://github.com/aurum-v2/aurum-ouath-v2.git","type":"git"},"_npmVersion":"10.9.2","description":"Reusable Aurum OAuth (Continue with Aurum) React provider, hooks, and helpers","directories":{},"sideEffects":false,"_nodeVersion":"22.16.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"react":"^19.2.7","react-dom":"^19.2.7","typescript":"~5.8.3","@types/react":"^19.2.17","@types/react-dom":"^19.2.3"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/oauth-v2_0.1.7_1784094543475_0.8176217298011288","host":"s3://npm-registry-packages-npm-production"}},"0.1.8":{"name":"@aurum-v2/oauth-v2","version":"0.1.8","keywords":["aurum","oauth","pkce","react","sso"],"license":"UNLICENSED","_id":"@aurum-v2/oauth-v2@0.1.8","maintainers":[{"name":"aurum-v2","email":"no-reply@aurumplatform.io"}],"homepage":"https://github.com/aurum-v2/aurum-ouath-v2#readme","bugs":{"url":"https://github.com/aurum-v2/aurum-ouath-v2/issues"},"dist":{"shasum":"db9af0f05949b25277d9e5c3709e10ff823b8698","tarball":"https://registry.npmjs.org/@aurum-v2/oauth-v2/-/oauth-v2-0.1.8.tgz","fileCount":72,"integrity":"sha512-qmh0/ZKwEn6b7/cZBnlgaPzSJhjGsOAXXNAOuFYS1Hnp6ba3cMoGlgRQ6wbjo8zc2TfEkL9vA0Lh00XWwh5xUQ==","signatures":[{"sig":"MEYCIQDJ9LyuMKtliTyh3yM+JUmgdmyPaNHzTbtNooZN+LAadgIhAM9SbfmUs3NZkrm7b29whXF5H+iuwe2icVgzdvBxWQTg","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":151678},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./react":{"types":"./dist/react/index.d.ts","import":"./dist/react/index.js"}},"gitHead":"9a2f98b992aa26eb73e7cdb74fa7d1c820b56865","private":false,"scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"aurum-v2","email":"no-reply@aurumplatform.io"},"repository":{"url":"git+https://github.com/aurum-v2/aurum-ouath-v2.git","type":"git"},"_npmVersion":"10.9.2","description":"Reusable Aurum OAuth (Continue with Aurum) React provider, hooks, and helpers","directories":{},"sideEffects":false,"_nodeVersion":"22.16.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"react":"^19.2.7","react-dom":"^19.2.7","typescript":"~5.8.3","@types/react":"^19.2.17","@types/react-dom":"^19.2.3"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/oauth-v2_0.1.8_1787541795011_0.9010204877064187","host":"s3://npm-registry-packages-npm-production"}},"0.1.9":{"name":"@aurum-v2/oauth-v2","version":"0.1.9","keywords":["aurum","oauth","pkce","react","sso"],"license":"UNLICENSED","_id":"@aurum-v2/oauth-v2@0.1.9","maintainers":[{"name":"aurum-v2","email":"no-reply@aurumplatform.io"}],"homepage":"https://github.com/aurum-v2/aurum-ouath-v2#readme","bugs":{"url":"https://github.com/aurum-v2/aurum-ouath-v2/issues"},"dist":{"shasum":"4ed5e4d8b1fbe964fa993a974e03b8afb97eeeee","tarball":"https://registry.npmjs.org/@aurum-v2/oauth-v2/-/oauth-v2-0.1.9.tgz","fileCount":72,"integrity":"sha512-3UO1MO5kh5Zvz4S0i0yfWn7A2ep394JE8FowJsyFxLHBA/4fyei3QJXkRlP9oEOIxu6yNNRgrtP44noAeeo+bA==","signatures":[{"sig":"MEUCIQCT7OeO4gPxpIcJFVpE6qMyYQQL6FY4qQH7Fo23Qs64OgIgW7+kq1GEpMTtVGzrAXP1SOQNva+K1bzIt4Za0fda7WQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":151787},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./react":{"types":"./dist/react/index.d.ts","import":"./dist/react/index.js"}},"gitHead":"312d386393819d07be3883169ab014cfd47ec38b","private":false,"scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"aurum-v2","email":"no-reply@aurumplatform.io"},"repository":{"url":"git+https://github.com/aurum-v2/aurum-ouath-v2.git","type":"git"},"_npmVersion":"10.9.2","description":"Reusable Aurum OAuth (Continue with Aurum) React provider, hooks, and helpers","directories":{},"sideEffects":false,"_nodeVersion":"22.16.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"react":"^19.2.7","react-dom":"^19.2.7","typescript":"~5.8.3","@types/react":"^19.2.17","@types/react-dom":"^19.2.3"},"peerDependencies":{"react":">=18","react-dom":">=18"},"_npmOperationalInternal":{"tmp":"tmp/oauth-v2_0.1.9_1787542444866_0.020159093030061248","host":"s3://npm-registry-packages-npm-production"}},"0.1.10":{"name":"@aurum-v2/oauth-v2","version":"0.1.10","description":"Reusable Aurum OAuth (Continue with Aurum) React provider, hooks, and helpers","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./react":{"types":"./dist/react/index.d.ts","import":"./dist/react/index.js"}},"sideEffects":false,"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","clean":"rm -rf dist"},"peerDependencies":{"react":">=18","react-dom":">=18"},"devDependencies":{"@types/react":"^19.2.17","@types/react-dom":"^19.2.3","react":"^19.2.7","react-dom":"^19.2.7","typescript":"~5.8.3"},"keywords":["aurum","oauth","pkce","react","sso"],"license":"UNLICENSED","private":false,"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"repository":{"type":"git","url":"git+https://github.com/aurum-v2/aurum-ouath-v2.git"},"_id":"@aurum-v2/oauth-v2@0.1.10","gitHead":"6e1cbaaa2d21226fe232f47986a8d05f5802082b","bugs":{"url":"https://github.com/aurum-v2/aurum-ouath-v2/issues"},"homepage":"https://github.com/aurum-v2/aurum-ouath-v2#readme","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-xqJePUPx4FH9+M8LivYOE4ZmV2Hv4dWmuwsSXIc7CvGLuTcl79RXjkdvUMs7YdeHsCl/HQWiG4xcaU1tBG1C0g==","shasum":"c1169658c3494f46d72fb8e398e1dea14ed12958","tarball":"https://registry.npmjs.org/@aurum-v2/oauth-v2/-/oauth-v2-0.1.10.tgz","fileCount":77,"unpackedSize":163249,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCT7KqNyM2uw9suTTkWoo61Id+RYKVXDLfVeacI28sWxgIhAMJeA1Rv2PnA7JEQWx0q5UhNwQoO16V/boSUfe4x4pim"}]},"_npmUser":{"name":"aurum-v2","email":"no-reply@aurumplatform.io"},"directories":{},"maintainers":[{"name":"aurum-v2","email":"no-reply@aurumplatform.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/oauth-v2_0.1.10_1787558342998_0.027258423318301084"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-15T05:49:03.266Z","modified":"2026-08-24T07:59:03.297Z","0.1.7":"2026-07-15T05:49:03.608Z","0.1.8":"2026-08-24T03:23:15.163Z","0.1.9":"2026-08-24T03:34:05.007Z","0.1.10":"2026-08-24T07:59:03.165Z"},"bugs":{"url":"https://github.com/aurum-v2/aurum-ouath-v2/issues"},"license":"UNLICENSED","homepage":"https://github.com/aurum-v2/aurum-ouath-v2#readme","keywords":["aurum","oauth","pkce","react","sso"],"repository":{"type":"git","url":"git+https://github.com/aurum-v2/aurum-ouath-v2.git"},"description":"Reusable Aurum OAuth (Continue with Aurum) React provider, hooks, and helpers","maintainers":[{"name":"aurum-v2","email":"no-reply@aurumplatform.io"}],"readme":"# `@aurum-v2/oauth-v2`\n\nReusable **Continue with Aurum** (OAuth PKCE) package: config-driven storage, popup sign-in, React context, and hooks.\n\n## Install (GitHub Packages)\n\nThen:\n\n```bash\nnpm install @aurum-v2/oauth-v2\n```\n\n\n```tsx\nimport { AurumAuthProvider, useAurumAuth } from '@aurum-v2/oauth-v2'\n\nroot.render(\n  <AurumAuthProvider\n    config={{\n      clientId: import.meta.env.VITE_AURUM_OAUTH_CLIENT_ID,\n      apiBaseUrl: import.meta.env.VITE_API_BASE_URL, // e.g. /api/v2\n      storageKey: 'aup_ev', // unique per product\n      redirectPath: '/oauth/callback',\n      scopes: 'openid profile email',\n    }}\n  >\n    <App />\n  </AurumAuthProvider>,\n)\n```\n\n```tsx\nfunction Header() {\n  const {\n    user,\n    isAuthenticated,\n    loading,\n    signingIn,\n    signInWithPopup,\n    signOut,\n    signInHref,\n  } = useAurumAuth()\n\n  if (loading) return null\n\n  if (!isAuthenticated) {\n    return (\n      <button\n        type=\"button\"\n        disabled={signingIn}\n        onClick={() => void signInWithPopup()}\n      >\n        Continue with Aurum\n      </button>\n      // or: <a href={signInHref()}>Continue with Aurum</a>\n    )\n  }\n\n  return (\n    <div>\n      <span>{user?.displayName}</span>\n      <button type=\"button\" onClick={() => void signOut()}>\n        Sign out\n      </button>\n    </div>\n  )\n}\n```\n\n## OAuth callback route (app owns the page)\n\n```tsx\nimport { useEffect, useState } from 'react'\nimport { useAurumAuth } from '@aurum-v2/oauth-v2'\n\nexport function OauthCallbackPage() {\n  const { client } = useAurumAuth()\n  const [error, setError] = useState<string | null>(null)\n\n  useEffect(() => {\n    const params = new URLSearchParams(window.location.search)\n    void client.callback\n      .handleCallbackParams({\n        code: params.get('code'),\n        state: params.get('state'),\n        error: params.get('error'),\n        errorDescription: params.get('error_description'),\n      })\n      .then((outcome) => {\n        if (!outcome.ok) {\n          setError(outcome.error)\n          return\n        }\n        if (client.callback.isOauthPopupWindow()) {\n          window.setTimeout(() => window.close(), 400)\n          return\n        }\n        window.location.replace(outcome.returnPath)\n      })\n  }, [client])\n\n  if (error) return <p>{error}</p>\n  return <p>Completing Sign in with Aurum…</p>\n}\n```\n\n## Config\n\n| Field | Required | Notes |\n|---|---|---|\n| `clientId` | yes | SSO client id |\n| `apiBaseUrl` | yes | e.g. `/api/v2` or `https://api.example.com/api/v2` |\n| `storageKey` | yes | Namespace for tokens (`aup_ev`, `checkout`, …) |\n| `redirectPath` | no | Default `/oauth/callback` |\n| `scopes` | no | Default `openid profile email` |\n| `promptConsent` | no | Default `true` |\n\nUse a **different `storageKey` per product** so sessions never overwrite each other.\n\nSSO login is **not available for sub-accounts**. Sub-accounts are denied at the IdP (`access_denied`). Callbacks surface `SSO is not available for sub-accounts.` — import `SSO_SUB_ACCOUNT_DENIED_MESSAGE` / `formatOauthCallbackError` if you need the same copy.\n\n## Legacy wallet (authenticated)\n\nRequires a signed-in OAuth session. The API looks up the caller's row in `legacy_wallets` only — other users' addresses are never returned.\n\n```tsx\nimport { useAurumLegacyWallet } from '@aurum-v2/oauth-v2'\n\nfunction WalletLine() {\n  const { walletAddress, oldWalletAddress, loading, error } =\n    useAurumLegacyWallet()\n\n  if (loading) return null\n  if (error) return <p>{error}</p>\n  return (\n    <div>\n      <p>{walletAddress ?? 'No wallet on file'}</p>\n      <p>{oldWalletAddress ?? 'No previous wallet'}</p>\n    </div>\n  )\n}\n```\n\nOr call `client.api.fetchLegacyWallet()` after sign-in.\n\n## Imperative (no React)\n\n```ts\nimport { createAurumOauthClient } from '@aurum-v2/oauth-v2'\n\nconst client = createAurumOauthClient({\n  clientId: '...',\n  apiBaseUrl: '/api/v2',\n  storageKey: 'my_app',\n})\n\nconst url = await client.buildSignInUrl({ returnPath: '/' })\n```\n","readmeFilename":"README.md"}