Home Reference Source
import AuthTokenManager from 'neo4j-driver-core/lib/auth-token-manager.js'
public interface | since 5.14 | source

AuthTokenManager

Interface for the piece of software responsible for keeping track of current active AuthToken across the driver.

Method Summary

Public Methods
public

getToken(): Promise<AuthToken> | AuthToken

Returns a valid token.

public

handleSecurityException(token: AuthToken, securityErrorCode: `Neo.ClientError.Security.${string}`): boolean

Handles an error notification emitted by the server if a security error happened.

Public Methods

public getToken(): Promise<AuthToken> | AuthToken source

Returns a valid token.

Warning: This method must only ever return auth information belonging to the same identity. Switching identities using the AuthTokenManager is undefined behavior.

Return:

Promise<AuthToken> | AuthToken

The valid auth token or a promise for a valid auth token

public handleSecurityException(token: AuthToken, securityErrorCode: `Neo.ClientError.Security.${string}`): boolean source

Handles an error notification emitted by the server if a security error happened.

Params:

NameTypeAttributeDescription
token AuthToken

The expired token.

securityErrorCode `Neo.ClientError.Security.${string}`

the security error code returned by the server

Return:

boolean

whether the exception was handled by the manager, so the driver knows if it can be retried..