Akord docs
  • Introduction
    • 👋About Akord
    • 🌇Akord–Arweave Sunsetting FAQs
    • Page
  • API & DEV TOOLS
    • 🕺Simple API upload
    • 🤓Learn
      • Akord protocol
        • Tags
        • Vault
          • Fields
          • Functions
            • vault:init
            • vault:update
            • vault:archive
            • vault:restore
        • Membership
          • Fields
          • Functions
            • membership:invite
            • membership:accept
            • membership:reject
            • membership:revoke
            • membership:change-role
            • membership:update
        • Node
          • Fields
          • Functions
            • node:create
            • node:update
            • node:move
            • node:revoke
            • node:restore
            • node:delete
      • Publishing a website
        • Troubleshooting website publishing
      • Technical Litepaper
      • End-to-end encryption
      • Bundling
    • 🏗️Build
      • REST API
        • Authentication
        • Rate limits
        • Timeouts
        • Webhooks
        • Examples
          • Simple uploads
          • Multipart uploads
      • SDK – AkordJS
        • Usage
        • Modules
          • Auth
          • Vault
          • Membership
          • Folder
          • Stack (file)
          • Manifest
          • Note
          • Memo (message)
          • Batch
        • Examples
      • CLI
        • Quick start
        • Login
        • Vaults
        • Files and stacks
        • Memos / messages
        • Folders
        • Memberships
      • Arweave Gateway – AKRD
  • App
    • 💻Product guides
      • Signing up
        • Akord Wallet
        • Recovery phrase explained
      • Akord Vaults
        • Vault types explained
        • Creating a vault
        • Vault info
      • File management
        • Uploading files
        • File info
        • Sort/filter, folders & batch actions
        • File versioning
      • Add manifest
      • Sharing files
      • Media gallery
      • Invites
      • Messaging
      • Notes
      • Timeline
      • Storage
        • Monitoring usage
        • Top ups
        • Blockchain transactions
      • Account
        • Reveal recovery phrase
        • Change password
        • Account deletion
Powered by GitBook
On this page

Was this helpful?

  1. API & DEV TOOLS
  2. Build
  3. SDK – AkordJS
  4. Modules

Auth

Use Auth module to handle authentication.

import { Auth } from "@akord/akord-js";
  • By default Auth is using SRP authentication

  • Auth stores tokens in Storage implementation

  • Storage defaults to localStorage on web & memoryStorage on nodeJs

  • Storage implementation can be configured with Auth.configure({ storage: window.sessionStorage })

  • Auth is automatically refreshing tokens in SRP mode

  • On server side it is recommended to use API keys: Auth.configure({ apiKey: 'your_api_key' })

  • API key: can be generated over web app & over CLI

Short-lived token with refresh

import { Auth } from "@akord/akord-js";
Auth.configure({ storage: window.sessionStorage }); // optionally - configure tokens store

API key

import { Auth } from "@akord/akord-js";
Auth.configure({ apiKey: "api_key" });

Self-managed auth token

import { Akord, Auth } from "@akord/akord-js";
Auth.configure({ authToken: "auth_token" });

signIn(email, password)

  • email (string, required)

  • password (string, required)

  • returns Promise<{ wallet, jwt }> - Promise with JWT token & Akord Wallet

example
const { wallet } = await Auth.signIn("winston@gmail.com", "1984");

signUp(email, password)

  • email (string, required)

  • password (string, required)

  • clientMetadata (any, optional) - JSON client metadata, ex: { clientType: "CLI" }

  • returns Promise<AkordWallet> - Promise with Akord Wallet

example
const { wallet } = await Auth.signUp("winston@gmail.com", "1984");

verifyAccount(email, code)

  • email (string, required)

  • code (string, required)

  • returns Promise<void>

example
await Auth.verifyAccount("winston@gmail.com", 123456);

Last updated 1 year ago

Was this helpful?

🏗️