Skip to content

Getting 'Not authenticated' error for airflowctl commands #55414

Closed

Description

@atuls4441

Apache Airflow version

main (development)

If "Other Airflow 2 version" selected, which one?

No response

What happened?

Installed package:

root@f17bd88a475e:/opt/airflow# pip show apache-airflow-ctl
Name: apache-airflow-ctl
Version: 1.0.0b1
Summary: Apache Airflow command line tool for communicating with an Apache Airflow, using the API.
Home-page: 
Author: 
Author-email: 
License: 
Location: /usr/python/lib/python3.10/site-packages
Editable project location: /opt/airflow/airflow-ctl
Requires: argcomplete, httpx, keyring, lazy-object-proxy, methodtools, platformdirs, pydantic, rich-argparse, structlog, tabulate, uuid6
Required-by: 

Error:

root@f17bd88a475e:/opt/airflow# airflowctl auth login --api-url http://localhost:28080/api/v2 --env AIRFLOW_CLI_ENVIRONMENT
Please set a password for your new keyring: 
Please confirm the password: 
Error: blank passwords aren't allowed.
Please set a password for your new keyring: 
Please confirm the password: 
Login successful! Welcome to airflowctl!
root@f17bd88a475e:/opt/airflow# airflowctl assets create-event --asset-id 1
2025-09-09 13:41:29 [warning  ] Server error                   [airflowctl.api.client] extra={'detail': 'Not authenticated'}
Server response error: Client error message: {'detail': 'Not authenticated'}
Client error,  Please check the command and its parameters. If you need help, run the command with --help.

What you think should happen instead?

No response

How to reproduce

Try to run airflowctl commands as per this doc

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Other

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bug
    needs-triage
    on Sep 9, 2025
  2. added
    area:API
    on Sep 9, 2025
  3. Prab-27 commented on Sep 9, 2025

    @Prab-27
    Contributor

    @bugraoz93 ,When I try to reproduce this, it shows me...

    ...
    root@78202b4db989:/opt/airflow# export AIRFLOW_CLI_TOKEN=admin
    root@78202b4db989:/opt/airflow#  airflowctl auth login --api-url http://localhost:28080/api/v2 --env AIRFLOW_CLI_ENVIRONMENT
    Please enter password for encrypted keyring:
    Login successful! Welcome to airflowctl!
    root@78202b4db989:/opt/airflow# airflowctl assets create-event --asset-id 1
    Please enter password for encrypted keyring:
    2025-09-09 16:39:09 [warning  ] Server error                   [airflowctl.api.client] extra={'detail': [{'type': 'dict_type', 'loc': ['body', 'extra'], 'msg': 'Input should be a valid dictionary', 'input': None}]}
    Server response error: Client error message: {'detail': [{'type':
    'dict_type', 'loc': ['body', 'extra'], 'msg': 'Input should be a
    valid dictionary', 'input': None}]}
    Client error,  Please check the command and its parameters. If you
    need help, run the command with --help.
    
  4. bugraoz93 commented on Sep 9, 2025

    @bugraoz93
    Contributor

    @bugraoz93 ,When I try to reproduce this, it shows me...

    ...
    root@78202b4db989:/opt/airflow# export AIRFLOW_CLI_TOKEN=admin
    root@78202b4db989:/opt/airflow#  airflowctl auth login --api-url http://localhost:28080/api/v2 --env AIRFLOW_CLI_ENVIRONMENT
    Please enter password for encrypted keyring:
    Login successful! Welcome to airflowctl!
    root@78202b4db989:/opt/airflow# airflowctl assets create-event --asset-id 1
    Please enter password for encrypted keyring:
    2025-09-09 16:39:09 [warning  ] Server error                   [airflowctl.api.client] extra={'detail': [{'type': 'dict_type', 'loc': ['body', 'extra'], 'msg': 'Input should be a valid dictionary', 'input': None}]}
    Server response error: Client error message: {'detail': [{'type':
    'dict_type', 'loc': ['body', 'extra'], 'msg': 'Input should be a
    valid dictionary', 'input': None}]}
    Client error,  Please check the command and its parameters. If you
    need help, run the command with --help.
    

    Thanks for checking @Prab-27! AIRFLOW_CLI_TOKEN should be acquired from the API manually because that is the JWT token. Strangely, you would be able to get a successful response. Maybe that is another bug. I will check it.

  5. bugraoz93 commented on Sep 9, 2025

    @bugraoz93
    Contributor

    @bugraoz93 ,When I try to reproduce this, it shows me...

    ...
    root@78202b4db989:/opt/airflow# export AIRFLOW_CLI_TOKEN=admin
    root@78202b4db989:/opt/airflow#  airflowctl auth login --api-url http://localhost:28080/api/v2 --env AIRFLOW_CLI_ENVIRONMENT
    Please enter password for encrypted keyring:
    Login successful! Welcome to airflowctl!
    root@78202b4db989:/opt/airflow# airflowctl assets create-event --asset-id 1
    Please enter password for encrypted keyring:
    2025-09-09 16:39:09 [warning  ] Server error                   [airflowctl.api.client] extra={'detail': [{'type': 'dict_type', 'loc': ['body', 'extra'], 'msg': 'Input should be a valid dictionary', 'input': None}]}
    Server response error: Client error message: {'detail': [{'type':
    'dict_type', 'loc': ['body', 'extra'], 'msg': 'Input should be a
    valid dictionary', 'input': None}]}
    Client error,  Please check the command and its parameters. If you
    need help, run the command with --help.
    

    Thanks for checking @Prab-27! AIRFLOW_CLI_TOKEN should be acquired from the API manually because that is the JWT token. You can add --username=admin --password at the end and you should be elevated automatically

  6. bugraoz93 commented on Sep 9, 2025

    @bugraoz93
    Contributor

    Thanks a lot @atul-astronomer! I wrongly closed it. I will check this out and fix it soon

  7. self-assigned this
    on Sep 9, 2025
  8. removed
    needs-triage
    on Sep 9, 2025
  9. bugraoz93 commented on Sep 9, 2025

    @bugraoz93
    Contributor

    @Prab-27, that seems like another problem related to maybe the datamodel not being generated properly. I will handle that separately. It seems that only for assets which also support the datamodel or API update we should update.

    Image
  10. added
    affected_version:3.1
    priority:high
    on Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

affected_version:3.1area:APIarea:airflow-ctlarea:autharea:corekind:bugpriority:high

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions