Tokens

    To use token authentication, you can specify an section with the token property set:

    Token authentication can be used in the authorization section for clients and clusters.

    1. > nats-server --auth s3cr3t

    A client can easily connect by specifying the server URL:

    Tokens can be bcrypted enabling an additional layer of security, as the clear-text version of the token would not be persisted on the server configuration file.

    1. ? Enter password [? for help] **********************
    2. ? Reenter password [? for help] **********************
    3. $2a$11$PWIFAL8RsWyGI3jVZtO9Nu8.6jOxzxfZo7c/W0eLk017hjgUKWrhy

    Here’s a simple configuration file:

    The client will still require the clear-text token to connect:

    1. nats-sub -s nats://dag0HTXl4RGg7dXdaJwbC8@localhost:4222 ">"