Getting Error Message as Invalid Token (Permission Denied) in Synapse Server

Hi,
I am trying to send commands to axon server but facing permission denied And invalid token.
Please find the error message. I am able to create Commands and even handler but after sending commands through http to synapse facing this issue, I can see sent commands in axon server but not able to see events being populated.

2024-06-17 15:59:55.562 INFO 18812 — [ault-executor-5] i.a.a.c.impl.AxonServerManagedChannel : Requesting connection details from localhost:8124
2024-06-17 15:59:55.606 INFO 18812 — [ault-executor-5] i.a.a.c.impl.AxonServerManagedChannel : Successfully connected to localhost:8124
2024-06-17 15:59:55.606 INFO 18812 — [ault-executor-5] i.a.a.connector.impl.ControlChannelImpl : Connected instruction stream for context ‘default’. Sending client identification
2024-06-17 15:59:55.752 WARN 18812 — [ault-executor-5] i.a.s.security.AxonServerTokenService : Error validating token

io.grpc.StatusRuntimeException: PERMISSION_DENIED: [AXONIQ-1001] Invalid token

Hi Naveen,

Given the error message you received, I assume you’ve enabled access control in the Axon Server.

Have you created server tokens for your command and event handlers? Tokens can be created via API. The token value is an application token from Axon Server. Once tokens are created, command and event handlers should be associated with server token IDs.

Does your application that sends commands include an Axon Server authentication token in the X-API-KEY header?

Best,
Michal

Thanks it worked After passing Token