Menu
MagicMagicDashboardGuidesGitHubSupport
Homepage
MagicMagic
  • Dashboard
  • Guides
  • GitHub
  • Support
  • Homepage
MagicMagic
  • ๐Ÿ‘‹ Introduction
    • Get Started
    • Security
    • Decentralized ID
    • Customization
    • Social Login
    • WebAuthn
    • FAQ
  • ๐Ÿ“— Client SDK
    • Web
      • Get Started
      • API Reference
      • Social Login
      • Examples
        • Re-authenticating Users
        • Migrating From Fortmatic
    • React Native
      • Get Started
      • Social Login
    • iOS
      • Get Started
      • API Reference
      • Social Login
    • Android
      • Get Started
      • API Reference
  • ๐Ÿ“™ Admin SDK
    • Node
      • Get Started
      • API Reference
      • Examples
        • Log Out a User's Magic Session
    • Python
      • Get Started
      • API Reference
      • Examples
        • User Signup
        • User Login
        • User Logout
    • Ruby
      • Get Started
      • API Reference
      • Examples
        • User Signup
        • User Login
        • User Logout
    • PHP
      • Get Started
      • API Reference
      • Examples
        • User Signup
        • User Login
        • User Logout
      • Laravel
        • Get Started
        • API Reference
        • Examples
          • User Signup
          • User Login
          • User Logout
    • Go
      • Get Started
      • API Reference
      • Examples
        • User Signup
        • User Login
        • User Logout
    • (Coming Soon)
  • โ›“ Blockchains
    • Ethereum
    • Tezos
    • Polkadot
    • Zilliqa
    • ICON
    • Solana
    • Avalanche
    • Harmony
    • Algorand

Log Out a User's Magic Session

Sometimes you will find yourself needing to log your users out from the server-side. This provides a small example of how to do so.

0. Prerequisite: Install Magic Admin SDKโ€‹

1. Invalidate the user session:

  • With public address
  • With DID Token
app.post('/logout', (req: any, res: any) => {
const userPublicAddress = magicAdmin.token.getPublicAddress(
req.headers.authorization
);
magicAdmin.users.logoutByPublicAddress(userPublicAddress);
});
Edit this page
Previous
ยซ API Reference
Next
Get Started ยป

Company

  • Legal
  • Careers
  • Security
  • GitHub

Resources

  • Docs
  • Brand Assets
  • Whitepaper
  • Status

Social

  • Blog
  • Twitter
  • Newsletter
Copyright ยฉ 2021 Magic Labs, Inc. โœจ