Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
crossbar 25.12.1
Logo
Light Logo Dark Logo
  • Introduction
  • Installation
  • Reproducible Builds with uv.lock
  • Getting Started
  • What is WAMP?
  • Introduction
  • WAMP Clients
  • Prerequisite
  • What’s in this guide
  • Basic Concept:
  • Node Controller:
  • Router:
  • Installing Docker
  • Example Code
  • Starting a Crossbar.io Router
  • Crossbar configuration
  • Hello World
  • NodeJS Example
  • RPC Example
  • Modifying Things
  • Further Materials
  • Programming Guide
    • Starting and Stopping Crossbar.io
    • Startup and Shutdown Behavior
    • Configuring Crossbar.io Logging
    • URI Format
    • Logging in Crossbar.io
    • Error Handling
    • Session Meta Events and Procedures
    • Session Statistics
    • Development with External Devices
    • How Subscriptions Work
    • Next
    • Basic Subscriptions
    • Subscriber Black- and Whitelisting
    • Publisher Exclusion
    • Publisher Identification
    • Pattern Based Subscriptions
    • Subscription Meta Events and Procedures
    • Event History
    • Retained Events
    • Retrieving an Event
    • Example
    • How Registrations Work
    • Basic Registrations
    • Caller Identification
    • Progressive Call Results
    • Pattern-Based Registrations
    • Shared Registrations
    • Registration Meta-Events and Procedures
    • End-to-end Encryption
    • cryptobox
    • Cryptobox Payload Encryption
    • Adding Real-Time to Django Applications
    • First steps
    • The HTML
    • Client monitoring
    • Crossbar.io
    • AngularJS Application Components
    • Minimal Example
    • Database Programming with PostgreSQL
    • Frameworks
    • Libraries
    • UI frameworks
  • Administration Guide
    • Basic Concepts
    • Node Configuration
    • IoT Microservice Weather Balloon example using Container Component with Dynamic Authentication
    • Processes
    • Controller Configuration
    • Router Configuration
    • Router Realms
    • Router Components
    • Proxy-Workers
    • Container Configuration
    • Guest Configuration
    • Native Worker Options
    • Process Environments
    • Router Transports
    • Transport Endpoints
    • WebSocket Transport
    • WebSocket Options
    • WebSocket Compression
    • RawSocket Transport
    • Flash Policy Transport
    • Web Transport and Services
    • Web Services
    • Static Web Service
    • Web Redirection Service
    • JSON Value Service
    • Node Info Service
    • CGI Script Service
    • WSGI Host Service
    • Reverse Proxy Service
    • WebSocket Service
    • Long-poll Service
    • Path Service
    • Resource Service
    • File Upload Service
    • Web Archives
    • HTTP Bridge
    • HTTP Bridge Publisher
    • HTTP Bridge Subscriber
    • HTTP Bridge Caller
    • HTTP Bridge Callee
    • HTTP Bridge Webhook
    • Authentication
    • Anonymous Authentication
    • Ticket Authentication
    • Challenge-Response Authentication
    • SCRAM Authentication
    • Cryptosign Authentication
    • Cookie Authentication
    • TLS Client Certificate authentication
    • Dynamic Authenticators
    • Authorization
    • Secure WebSocket and HTTPS
    • TLS Certificates
    • Updating Certificates
    • SSL/TLS Interception Proxies
    • Cookie Tracking
    • MQTT Broker and Bridge
    • The Command Line
    • Logging
    • Going to Production
    • Automatic Startup and Restart
    • Running on Privileged Ports
    • Scaling Crossbar.io
    • Network Tuning
    • Reverse Proxies
    • Installation on Linux
    • Installation on Mac OS X
    • Installation on Windows
    • Creating Docker Images
    • Setup on Amazon EC2
    • Setup on Heroku
    • Setup on OpenShift
  • Release Notes
  • Changelog
  • Contributing
  • WAMP Projects Overview
  • AI Policy
    • AI Contributors Policy
    • AI Assistants Policy
    • Disclosure of Use of AI Assistance
    • AI-Assisted Work Audit Log
    • AI Disclosure Process
    • AI Audit Process Review
  • API Reference
    • crossbar
      • crossbar._compat
      • crossbar._log_categories
      • crossbar._logging
      • crossbar._util
      • crossbar.bridge
        • crossbar.bridge.mqtt
          • crossbar.bridge.mqtt._events
          • crossbar.bridge.mqtt._utils
          • crossbar.bridge.mqtt.protocol
          • crossbar.bridge.mqtt.tx
          • crossbar.bridge.mqtt.wamp
        • crossbar.bridge.rest
          • crossbar.bridge.rest.callee
          • crossbar.bridge.rest.caller
          • crossbar.bridge.rest.common
          • crossbar.bridge.rest.publisher
          • crossbar.bridge.rest.subscriber
          • crossbar.bridge.rest.webhook
      • crossbar.common
        • crossbar.common.checkconfig
        • crossbar.common.fswatcher
        • crossbar.common.key
        • crossbar.common.monitor
        • crossbar.common.process
        • crossbar.common.processinfo
        • crossbar.common.profiler
        • crossbar.common.reloader
        • crossbar.common.twisted
          • crossbar.common.twisted.endpoint
          • crossbar.common.twisted.processutil
          • crossbar.common.twisted.sharedport
          • crossbar.common.twisted.tlsctx
          • crossbar.common.twisted.web
      • crossbar.edge
        • crossbar.edge.node
          • crossbar.edge.node.docker
          • crossbar.edge.node.management
          • crossbar.edge.node.node
        • crossbar.edge.personality
        • crossbar.edge.webservice
          • crossbar.edge.webservice.pairme
        • crossbar.edge.worker
          • crossbar.edge.worker.auth
          • crossbar.edge.worker.hostmonitor
          • crossbar.edge.worker.monitor
            • crossbar.edge.worker.monitor._base
            • crossbar.edge.worker.monitor._cpu
            • crossbar.edge.worker.monitor._disk
            • crossbar.edge.worker.monitor._hardware
            • crossbar.edge.worker.monitor._memory
            • crossbar.edge.worker.monitor._network
            • crossbar.edge.worker.monitor._process
            • crossbar.edge.worker.monitor._self
            • crossbar.edge.worker.monitor._storage
            • crossbar.edge.worker.monitor._system
          • crossbar.edge.worker.postgresql
          • crossbar.edge.worker.realmstore
          • crossbar.edge.worker.router
          • crossbar.edge.worker.tracing
          • crossbar.edge.worker.xbr
            • crossbar.edge.worker.xbr._authenticator
            • crossbar.edge.worker.xbr._marketmaker
            • crossbar.edge.worker.xbr._util
          • crossbar.edge.worker.xbrmm
      • crossbar.functest_helpers
        • crossbar.functest_helpers.auth
      • crossbar.interfaces
      • crossbar.master
        • crossbar.master.api
          • crossbar.master.api.container
          • crossbar.master.api.docker
          • crossbar.master.api.nativeprocess
          • crossbar.master.api.node
          • crossbar.master.api.proxy
          • crossbar.master.api.remote
          • crossbar.master.api.router
          • crossbar.master.api.tracing
          • crossbar.master.api.wamp
          • crossbar.master.api.worker
        • crossbar.master.arealm
          • crossbar.master.arealm.arealm
        • crossbar.master.cluster
          • crossbar.master.cluster.routercluster
          • crossbar.master.cluster.webcluster
        • crossbar.master.mrealm
          • crossbar.master.mrealm.controller
          • crossbar.master.mrealm.liveview
          • crossbar.master.mrealm.metadata
          • crossbar.master.mrealm.mrealm
        • crossbar.master.node
          • crossbar.master.node.authenticator
          • crossbar.master.node.controller
          • crossbar.master.node.messenger
          • crossbar.master.node.node
          • crossbar.master.node.roles
          • crossbar.master.node.user
        • crossbar.master.personality
        • crossbar.master.webservice
          • crossbar.master.webservice.registerme
        • crossbar.master.xbr
          • crossbar.master.xbr._marketplace
      • crossbar.network
        • crossbar.network._api
        • crossbar.network._authenticator
        • crossbar.network._backend
        • crossbar.network._error
        • crossbar.network._mailgw
        • crossbar.network._util
        • crossbar.network._web
        • crossbar.network.node
          • crossbar.network.node.node
        • crossbar.network.personality
      • crossbar.node
        • crossbar.node.controller
        • crossbar.node.guest
        • crossbar.node.main
        • crossbar.node.native
        • crossbar.node.node
        • crossbar.node.template
        • crossbar.node.worker
      • crossbar.personality
      • crossbar.quickstart
        • crossbar.quickstart.main
        • crossbar.quickstart.quickstartvenv
      • crossbar.router
        • crossbar.router.auth
          • crossbar.router.auth.anonymous
          • crossbar.router.auth.cryptosign
          • crossbar.router.auth.pending
          • crossbar.router.auth.scram
          • crossbar.router.auth.ticket
          • crossbar.router.auth.tls
          • crossbar.router.auth.wampcra
        • crossbar.router.broker
        • crossbar.router.cookiestore
        • crossbar.router.dealer
        • crossbar.router.inventory
        • crossbar.router.longpoll
        • crossbar.router.observation
        • crossbar.router.protocol
        • crossbar.router.realmstore
        • crossbar.router.role
        • crossbar.router.router
        • crossbar.router.service
        • crossbar.router.session
        • crossbar.router.unisocket
        • crossbar.router.wildcard
      • crossbar.shell
        • crossbar.shell.app
        • crossbar.shell.client
        • crossbar.shell.command
        • crossbar.shell.config
        • crossbar.shell.idl
          • crossbar.shell.idl.generator
          • crossbar.shell.idl.loader
        • crossbar.shell.main
        • crossbar.shell.monitor
        • crossbar.shell.reflection
          • crossbar.shell.reflection.BaseType
          • crossbar.shell.reflection.Enum
          • crossbar.shell.reflection.EnumVal
          • crossbar.shell.reflection.Field
          • crossbar.shell.reflection.KeyValue
          • crossbar.shell.reflection.Object
          • crossbar.shell.reflection.RPCCall
          • crossbar.shell.reflection.Schema
          • crossbar.shell.reflection.Service
          • crossbar.shell.reflection.Type
        • crossbar.shell.repl
        • crossbar.shell.util
      • crossbar.webservice
        • crossbar.webservice.archive
        • crossbar.webservice.base
        • crossbar.webservice.catalog
        • crossbar.webservice.flashpolicy
        • crossbar.webservice.longpoll
        • crossbar.webservice.misc
        • crossbar.webservice.rest
        • crossbar.webservice.static
        • crossbar.webservice.wap
        • crossbar.webservice.websocket
        • crossbar.webservice.wsgi
      • crossbar.worker
        • crossbar.worker.container
        • crossbar.worker.controller
        • crossbar.worker.main
        • crossbar.worker.proxy
        • crossbar.worker.rlink
        • crossbar.worker.router
        • crossbar.worker.sample
          • crossbar.worker.sample._logging
        • crossbar.worker.testee
        • crossbar.worker.transport
        • crossbar.worker.types
Back to top
View this page
Edit this page

Cookie Authentication¶

Introduction¶

Cookie authentication works like this.

With cookie tracking enabled, a browser client or generally any WAMP client connecting via WAMP-over-WebSocket is handed out a randomly assigned cookie by Crossbar.io.

When the client then authenticates using a WAMP authentication method such as WAMP-CRA, upon successful authentication, Crossbar.io will attached the authentication information to the cookie stored in the cookie store (either transiently or persistently).

When the client then comes back later, and sends the cookie handed out previously, Crossbar.io will look up the cookie, and if the cookie has attached authentication information, it will immediately authenticate the client using the previously stored information.

Configuration¶

Here is part of a node configuration that enables cookie-tracking on a WebSocket transport, as well as enabling cookie-based authentication plus WAMP-CRA.

You can find a complete example here.

 "transports": [
    {
       "type": "web",
       "endpoint": {
          "type": "tcp",
          "port": 8080
       },
       "paths": {
          "/": {
             "type": "static",
             "directory": "../web"
          },
          "ws": {
             "type": "websocket",
             "cookie": {
                "store": {
                   "type": "file",
                   "filename": "cookies.dat"
                }
             },
             "auth": {
                "wampcra": {
                   "type": "static",
                   "users": {
                      "joe": {
                         "role": "frontend",
                         "secret": "123456"
                      }
                   }
                },
                "cookie": {
                }
             }
          }
       }
    }
]

Note that to use cookie-based authentication you have to activate cookie-tracking and at least one non-cookie based authentication method.

Next
TLS Client Certificate authentication
Previous
Cryptosign Authentication
Copyright © 2013-2025, typedef int GmbH (Germany)
Made with Sphinx and @pradyunsg's Furo
On this page
  • Cookie Authentication
    • Introduction
    • Configuration