Server Wallet authentication model, token lifecycle, and access key management
The server wallet authentication flow is designed to be idempotent — calling authenticate() multiple times with the same identity is safe and will reuse existing credentials when possible.
How It Works
authenticate() │ ├─ Token already in store? ──► Reuse it (no network call) │ └─ No token? │ ├─ Derive public key from accessKey ├─ POST /auth/create (register identity) ├─ POST /auth/exchange (get access token) └─ Store token ──► Return session
On the first call, the SDK:
Generates or accepts an accessKey (64-char hex string)
Derives a public key from it
Calls create to register the identity with the backend
Calls exchange to obtain an access token
Stores the token for future use
On subsequent calls with the same identity, the stored token is returned immediately.
Usage
userIdentity is your permanent wallet ID. Use the exact same string on every call — including after restarts and deploys. A different value creates a new wallet.
import { ServerSignerClient } from '@abstraxn/server-signer';const client = new ServerSignerClient({ apiKey: process.env.ABSTRAXN_API_KEY!,});// First run: omit accessKey// Later runs: pass the accessKey saved from the first authenticate()const session = await client.authenticate({ userIdentity: 'merchant-backend-user-001', accessKey: process.env.SERVER_WALLET_ACCESS_KEY,});
userIdentity + accessKey are a matched pair. Reusing an identity with a different access key returns 409 CONFLICT.
Parameters
Parameter
Type
Required
Description
userIdentity
string
Yes
Permanent ID for this wallet — must be the same string used at creation
accessKey
string
No
64-char hex key from first authenticate(). Omit on first run
userName
string
No
Display name for the wallet user
userEmail
string
No
Email for the wallet user
Return Value
Field
Type
Description
didCreate
boolean
true if this was a new identity, false if reusing existing token
accessToken
string
Current JWT access token
accessKey
string
The 64-char hex access key (generated or provided)
targetPublicKey
string
Public key derived from the access key
organizationId
string
Organization ID for this wallet
walletAddress
string
On-chain wallet address
Access Key Management
The accessKey is the root secret for a server wallet identity. It is used to derive the public key that identifies the wallet on-chain.
If you lose the access key, you cannot recover the same wallet identity. Always persist it in a secure secrets manager (AWS Secrets Manager, HashiCorp Vault, GCP Secret Manager, etc.).
First run — omit accessKey, save the returned key:
Gasless Relayer — combine server wallet with the EVM relayer
Export & Security — export private keys and follow security best practices
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Abstraxn Docs","colors":{"primary":"#3ECF8E"},"logo":{"light":"/logo.svg","dark":"/images/abstraxn-logo-dark.svg"},"favicon":"/images/favicon.png","navbar":{"links":[{"href":"/guides/getting-started","label":"Guide"}],"primary":{"type":"button","label":"Go to Dashboard","href":"https://dashboard.abstraxn.com/"}},"footer":{"socials":{"x":"https://x.com/AbstraxnX","github":"https://github.com/Abstraxn-Labs","linkedin":"https://www.linkedin.com/company/102879467","medium":"https://medium.com/@AbstraxnAI"}},"search":{"prompt":"Search docs…"},"contextual":{"options":["copy",{"title":"Open in Claude","description":"Ask Claude about this page","icon":"sparkles","href":{"base":"https://claude.ai/new","query":[{"key":"q","value":"Read from https://docs.abstraxn.com$path so I can ask questions about it."}]}}],"display":"header"},"integrations":{"telemetry":{"enabled":false}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"hasAudioNarration":false,"customDomains":[],"gitSource":{"type":"github","owner":"local","repo":"local","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":"local","isBase":true},"buildId":"local","clientVersion":"0.0.4338"},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":false,"isLoggedInCli":false,"mintExport":{}},"customCss":[]}
{"page":{"pagePath":"guides/wallets/server-wallet/authentication","slug":"/guides/wallets/server-wallet/authentication","pageMetadata":{"title":"Authentication","description":"Server Wallet authentication model, token lifecycle, and access key management","href":"/guides/wallets/server-wallet/authentication"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Server Wallet authentication model, token lifecycle, and access key management\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The server wallet authentication flow is designed to be `,_jsx(_components.strong,{children:`idempotent`}),` — calling `,_jsx(_components.code,{children:`authenticate()`}),` multiple times with the same identity is safe and will reuse existing credentials when possible.`]}),`\n`,_jsx(Heading,{level:`2`,id:`how-it-works`,children:`How It Works`}),`\n`,_jsx(CodeBlock,{numberOfLines:`11`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`authenticate()`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` │`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ├─ Token already in store? ──► Reuse it (no network call)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` │`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` └─ No token?`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` │`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ├─ Derive public key from accessKey`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ├─ POST /auth/create (register identity)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ├─ POST /auth/exchange (get access token)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` └─ Store token ──► Return session`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`On the `,_jsx(_components.strong,{children:`first call`}),`, the SDK:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Generates or accepts an `,_jsx(_components.code,{children:`accessKey`}),` (64-char hex string)`]}),`\n`,_jsx(_components.li,{children:`Derives a public key from it`}),`\n`,_jsxs(_components.li,{children:[`Calls `,_jsx(_components.code,{children:`create`}),` to register the identity with the backend`]}),`\n`,_jsxs(_components.li,{children:[`Calls `,_jsx(_components.code,{children:`exchange`}),` to obtain an access token`]}),`\n`,_jsx(_components.li,{children:`Stores the token for future use`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`On `,_jsx(_components.strong,{children:`subsequent calls`}),` with the same identity, the stored token is returned immediately.`]}),`\n`,_jsx(Heading,{level:`2`,id:`usage`,children:`Usage`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`userIdentity`}),` is your `,_jsx(_components.strong,{children:`permanent wallet ID`}),`. Use the `,_jsx(_components.strong,{children:`exact same string`}),` on every call — including after restarts and deploys. A different value creates a new wallet.`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`12`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ServerSignerClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@abstraxn/server-signer'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` client`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` ServerSignerClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`ABSTRAXN_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// First run: omit accessKey`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Later runs: pass the accessKey saved from the first authenticate()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` session`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`authenticate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` userIdentity:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'merchant-backend-user-001'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` accessKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`SERVER_WALLET_ACCESS_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`userIdentity`}),` + `,_jsx(_components.code,{children:`accessKey`}),` are a matched pair. Reusing an identity with a `,_jsx(_components.strong,{children:`different`}),` access key returns `,_jsx(_components.code,{children:`409 CONFLICT`}),`.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`parameters`,children:`Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Parameter`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`userIdentity`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`Yes`}),_jsxs(_components.td,{children:[_jsx(_components.strong,{children:`Permanent`}),` ID for this wallet — must be the same string used at creation`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`accessKey`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`No`}),_jsxs(_components.td,{children:[`64-char hex key from first `,_jsx(_components.code,{children:`authenticate()`}),`. Omit on first run`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`userName`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`Display name for the wallet user`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`userEmail`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`Email for the wallet user`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`return-value`,children:`Return Value`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`didCreate`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`boolean`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`true`}),` if this was a new identity, `,_jsx(_components.code,{children:`false`}),` if reusing existing token`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`accessToken`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`Current JWT access token`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`accessKey`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`The 64-char hex access key (generated or provided)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`targetPublicKey`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`Public key derived from the access key`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`organizationId`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`Organization ID for this wallet`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`walletAddress`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{children:`On-chain wallet address`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`access-key-management`,children:`Access Key Management`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`accessKey`}),` is the `,_jsx(_components.strong,{children:`root secret`}),` for a server wallet identity. It is used to derive the public key that identifies the wallet on-chain.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`If you lose the access key, you `,_jsx(_components.strong,{children:`cannot recover`}),` the same wallet identity. Always persist it in a secure secrets manager (AWS Secrets Manager, HashiCorp Vault, GCP Secret Manager, etc.).`]})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`First run`}),` — omit `,_jsx(_components.code,{children:`accessKey`}),`, save the returned key:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`5`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` session`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`authenticate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` userIdentity:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'merchant-backend-user-001'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// pick once — keep forever`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` secretsManager`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'SERVER_WALLET_ACCESS_KEY'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`session`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`accessKey`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Later runs`}),` — same `,_jsx(_components.code,{children:`userIdentity`}),`, provide the saved key:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` session`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`authenticate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` userIdentity:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'merchant-backend-user-001'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` accessKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`SERVER_WALLET_ACCESS_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`automatic-token-refresh`,children:`Automatic Token Refresh`}),`\n`,_jsx(_components.p,{children:`Authenticated API calls automatically handle expired tokens:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`A call receives a `,_jsx(_components.code,{children:`401 Unauthorized`}),` response`]}),`\n`,_jsxs(_components.li,{children:[`The SDK sends `,_jsx(_components.code,{children:`POST /auth/refresh`}),` with session credentials`]}),`\n`,_jsx(_components.li,{children:`If the refresh succeeds, the access token is updated and the original call is retried`}),`\n`,_jsx(_components.li,{children:`If the refresh fails, the error is thrown to the caller`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`No configuration is needed — this behavior is built into every authenticated method (`,_jsx(_components.code,{children:`whoami`}),`, `,_jsx(_components.code,{children:`signTransaction`}),`, `,_jsx(_components.code,{children:`exportPrivateKey`}),`, etc.).`]}),`\n`,_jsx(Heading,{level:`2`,id:`identity-conflicts`,children:`Identity Conflicts`}),`\n`,_jsxs(_components.p,{children:[`If you call `,_jsx(_components.code,{children:`authenticate`}),` with a `,_jsx(_components.code,{children:`userIdentity`}),` that already exists but provide a `,_jsx(_components.strong,{children:`different`}),` `,_jsx(_components.code,{children:`accessKey`}),`, the backend returns a `,_jsx(_components.code,{children:`409 CONFLICT`}),` error:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ConflictError: userIdentity 'merchant-backend-user-001'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`already exists with a different access key`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`This protects against accidental identity collisions. To resolve:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Use the `,_jsx(_components.strong,{children:`original`}),` access key for this identity, or`]}),`\n`,_jsxs(_components.li,{children:[`Choose a `,_jsx(_components.strong,{children:`different`}),` `,_jsx(_components.code,{children:`userIdentity`}),` string`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next Steps`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guides/wallets/server-wallet/transactions-and-signing`,children:`Transactions \u0026 Signing`}),` — send transactions, sign messages and typed data`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guides/wallets/server-wallet/gasless-relayer`,children:`Gasless Relayer`}),` — combine server wallet with the EVM relayer`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guides/wallets/server-wallet/export-and-security`,children:`Export \u0026 Security`}),` — export private keys and follow security best practices`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Authentication","description":"Server Wallet authentication model, token lifecycle, and access key management","href":"/guides/wallets/server-wallet/authentication"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"How It Works","slug":"how-it-works","depth":2,"children":[]},{"title":"Usage","slug":"usage","depth":2,"children":[{"title":"Parameters","slug":"parameters","depth":3,"children":[]},{"title":"Return Value","slug":"return-value","depth":3,"children":[]}]},{"title":"Access Key Management","slug":"access-key-management","depth":2,"children":[]},{"title":"Automatic Token Refresh","slug":"automatic-token-refresh","depth":2,"children":[]},{"title":"Identity Conflicts","slug":"identity-conflicts","depth":2,"children":[]},{"title":"Next Steps","slug":"next-steps","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"localhost","siteName":"Abstraxn Docs","title":"Authentication - Abstraxn Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"originalFileLocation":"guides/wallets/server-wallet/authentication.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Server Wallet authentication model, token lifecycle, and access key management\">\u003cmeta data-mint-head name=\"application-name\" content=\"Abstraxn Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/favicons/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/favicons/favicon-32x32.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/favicons/favicon-16x16.png\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/favicons/favicon.ico\">\u003cmeta data-mint-head property=\"og:title\" content=\"Authentication - Abstraxn Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Server Wallet authentication model, token lifecycle, and access key management\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Abstraxn Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://local./guides/wallets/server-wallet/authentication\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Authentication - Abstraxn Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Server Wallet authentication model, token lifecycle, and access key management\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/favicons/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Abstraxn Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#3ECF8E\">\u003clink data-mint-head rel=\"canonical\" href=\"https://local./guides/wallets/server-wallet/authentication\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guides/wallets/server-wallet/authentication.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Abstraxn Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Abstraxn Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/guides/wallets/server-wallet/authentication.md","siteName":"Abstraxn Docs","nav":{"tabs":[{"tab":"Getting Started","pages":[{"title":"Getting Started","href":""}]},{"tab":"Agentic Layer","pages":[{"title":"Agentic Layer","href":"/guides/ai/agent-kit-overview"}]},{"tab":"KYI Framework","pages":[{"title":"KYI Framework","href":"/guides/kyi/overview"}]},{"tab":"Wallets","pages":[{"title":"Wallets API Quickstart (SDK)","href":"/guides/wallets/quickstart"},{"group":"Get Started","pages":[{"group":"React","pages":[{"title":"React Quickstart","href":"/guides/wallets/get-started/react/quickstart"},{"group":"From scratch","pages":[{"title":"Initialization","href":"/guides/wallets/get-started/react/from-scratch/initialization"},{"title":"Environment Setup","href":"/guides/wallets/get-started/react/from-scratch/environment-setup"},{"title":"UI Customization","href":"/guides/wallets/get-started/react/from-scratch/ui-customization"},{"title":"App Integration","href":"/guides/wallets/get-started/react/from-scratch/app-integration"},{"title":"Dashboard Customization","href":"/guides/wallets/get-started/react/from-scratch/dashboard-customization"},{"title":"Hooks","href":"/guides/wallets/get-started/react/from-scratch/hooks"},{"title":"Delete account","href":"/guides/wallets/get-started/react/from-scratch/delete-account"},{"title":"Create chain wallet","href":"/guides/wallets/get-started/react/from-scratch/create-chain-wallet"}]}]},{"group":"React Native","pages":[{"title":"React Native Quickstart","href":"/guides/wallets/get-started/react-native/quickstart"},{"group":"From scratch","pages":[{"title":"Installation","href":"/guides/wallets/get-started/react-native/from-scratch/installation"},{"title":"Authentication","href":"/guides/wallets/get-started/react-native/from-scratch/authentication"},{"title":"Hooks","href":"/guides/wallets/get-started/react-native/from-scratch/hooks"},{"title":"MFA","href":"/guides/wallets/get-started/react-native/from-scratch/mfa"},{"title":"Solana","href":"/guides/wallets/get-started/react-native/from-scratch/solana"},{"title":"Link auth methods","href":"/guides/wallets/get-started/react-native/from-scratch/auth-linking"}]}]}]},{"group":"Server Wallet","pages":[{"title":"Server Wallet Quickstart","description":"Get started with Abstraxn Server Wallet SDK for backend signing and transactions","href":"/guides/wallets/server-wallet/quickstart"},{"title":"Authentication","href":"/guides/wallets/server-wallet/authentication"},{"title":"Transactions \u0026 Signing","description":"Server Wallet transaction flow, message signing, typed data, and raw payload signing","href":"/guides/wallets/server-wallet/transactions-and-signing"},{"title":"Gasless Relayer","href":"/guides/wallets/server-wallet/gasless-relayer"},{"title":"Export \u0026 Security","href":"/guides/wallets/server-wallet/export-and-security"}]}]},{"tab":"Web3 Infra","pages":[{"title":"Web3 Infra","href":"/guides/relayer"}]}]},"basePath":"","title":"Authentication - Abstraxn Docs","buildId":"815f1a3055e5","dynamics":[],"chunks":[]}