Skip to content

BUG: 401 Unauthorized with API Key on new Docker installation (v1.6.5) #1708

@Rafhageek

Description

@Rafhageek

Welcome!

  • Yes, I have searched for similar issues on GitHub and found none.

What did you do?

Hello Evolution API Team,

I am having trouble authenticating with a fresh Docker installation. I am consistently getting a 401 Unauthorized error, even when using the correct Global API Key.

Here is my setup and the debugging steps I have already taken:

1. Docker Image: atendai/evolution-api:v1.6.5

2. My .env file:
(Please don't share your real API Key here, just the structure)
AUTH_ENABLED=true
AUTH_STRATEGY=apikey
API_KEY_GLOBAL=MySecretKey123
DATABASE_ENABLED=true
DATABASE=MONGODB
DATABASE_CONNECTION_URI=mongodb://mongodb:27017
DATABASE_CONNECTION_DB_NAME=evolution_api

3. My docker-compose.yml file:
(Here you can paste the content of your docker-compose.yml file)

4. Diagnostic Test:
I ran a curl command from another container on the same Docker network, bypassing Nginx entirely. The API is reachable, but still returns a 401 error.

Command:
docker run --rm --network=evolution-stack_default curlimages/curl -v -X POST "http://evolution_api:8080/instance/create" -H "apikey: MySecretKey123" -H "Content-Type: application/json" -d '{"instanceName": "test-instance"}'

Result:
(Here you can paste the complete output of the curl command from your last screenshot)

This result shows the connection is successful, but the application rejects the valid API key. It seems to be an internal application issue. Could you please advise if this is a known bug or if there is a missing configuration step?

Thank you!

What did you expect?

Hello Evolution API Team,

I am having trouble authenticating with a fresh Docker installation. I am consistently getting a 401 Unauthorized error, even when using the correct Global API Key.

Here is my setup and the debugging steps I have already taken:

1. Docker Image: atendai/evolution-api:v1.6.5

2. My .env file:
(Please don't share your real API Key here, just the structure)
AUTH_ENABLED=true
AUTH_STRATEGY=apikey
API_KEY_GLOBAL=MySecretKey123
DATABASE_ENABLED=true
DATABASE=MONGODB
DATABASE_CONNECTION_URI=mongodb://mongodb:27017
DATABASE_CONNECTION_DB_NAME=evolution_api

3. My docker-compose.yml file:
(Here you can paste the content of your docker-compose.yml file)

4. Diagnostic Test:
I ran a curl command from another container on the same Docker network, bypassing Nginx entirely. The API is reachable, but still returns a 401 error.

Command:
docker run --rm --network=evolution-stack_default curlimages/curl -v -X POST "http://evolution_api:8080/instance/create" -H "apikey: MySecretKey123" -H "Content-Type: application/json" -d '{"instanceName": "test-instance"}'

Result:
(Here you can paste the complete output of the curl command from your last screenshot)

This result shows the connection is successful, but the application rejects the valid API key. It seems to be an internal application issue. Could you please advise if this is a known bug or if there is a missing configuration step?

Thank you!

What did you observe instead of what you expected?

Hello Evolution API Team,

I am having trouble authenticating with a fresh Docker installation. I am consistently getting a 401 Unauthorized error, even when using the correct Global API Key.

Here is my setup and the debugging steps I have already taken:

1. Docker Image: atendai/evolution-api:v1.6.5

2. My .env file:
(Please don't share your real API Key here, just the structure)
AUTH_ENABLED=true
AUTH_STRATEGY=apikey
API_KEY_GLOBAL=MySecretKey123
DATABASE_ENABLED=true
DATABASE=MONGODB
DATABASE_CONNECTION_URI=mongodb://mongodb:27017
DATABASE_CONNECTION_DB_NAME=evolution_api

3. My docker-compose.yml file:
(Here you can paste the content of your docker-compose.yml file)

4. Diagnostic Test:
I ran a curl command from another container on the same Docker network, bypassing Nginx entirely. The API is reachable, but still returns a 401 error.

Command:
docker run --rm --network=evolution-stack_default curlimages/curl -v -X POST "http://evolution_api:8080/instance/create" -H "apikey: MySecretKey123" -H "Content-Type: application/json" -d '{"instanceName": "test-instance"}'

Result:
(Here you can paste the complete output of the curl command from your last screenshot)

This result shows the connection is successful, but the application rejects the valid API key. It seems to be an internal application issue. Could you please advise if this is a known bug or if there is a missing configuration step?

Thank you!

Screenshots/Videos

No response

Which version of the API are you using?

Hello Evolution API Team,

I am having trouble authenticating with a fresh Docker installation. I am consistently getting a 401 Unauthorized error, even when using the correct Global API Key.

Here is my setup and the debugging steps I have already taken:

1. Docker Image: atendai/evolution-api:v1.6.5

2. My .env file:
(Please don't share your real API Key here, just the structure)
AUTH_ENABLED=true
AUTH_STRATEGY=apikey
API_KEY_GLOBAL=MySecretKey123
DATABASE_ENABLED=true
DATABASE=MONGODB
DATABASE_CONNECTION_URI=mongodb://mongodb:27017
DATABASE_CONNECTION_DB_NAME=evolution_api

3. My docker-compose.yml file:
(Here you can paste the content of your docker-compose.yml file)

4. Diagnostic Test:
I ran a curl command from another container on the same Docker network, bypassing Nginx entirely. The API is reachable, but still returns a 401 error.

Command:
docker run --rm --network=evolution-stack_default curlimages/curl -v -X POST "http://evolution_api:8080/instance/create" -H "apikey: MySecretKey123" -H "Content-Type: application/json" -d '{"instanceName": "test-instance"}'

Result:
(Here you can paste the complete output of the curl command from your last screenshot)

This result shows the connection is successful, but the application rejects the valid API key. It seems to be an internal application issue. Could you please advise if this is a known bug or if there is a missing configuration step?

Thank you!

What is your environment?

Windows

Other environment specifications

No response

If applicable, paste the log output

No response

Additional Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions