baptistegh commented on code in PR #75938:
URL: https://github.com/apache/airflow/pull/75938#discussion_r4602402969


##########
airflow-ctl/src/airflowctl/ctl/commands/auth_command.py:
##########
@@ -53,6 +87,38 @@ def login(args, api_client=NEW_API_CLIENT) -> None:
     password = args.password
     token = args.api_token or os.environ.get("AIRFLOW_CLI_TOKEN")
 
+    if args.sso:
+        if args.api_token or username or password:
+            rich.print(
+                "[red]--sso is not compatible with --api-token, --username or 
--password.", file=sys.stderr
+            )
+            sys.exit(1)
+        try:
+            api_token = _get_token_with_browser(args, api_client, api_url)
+        except Exception as e:
+            rich.print(f"[red]Login failed: {escape(str(e))}", file=sys.stderr)
+            sys.exit(1)
+        not_stored_reason = "The token was not stored." if args.skip_keyring 
else ""
+        try:
+            Credentials(
+                api_url=api_url,
+                api_token=api_token,
+                api_environment=args.env,
+                client_kind=ClientKind.AUTH,
+            ).save(args.skip_keyring)
+        except AirflowCtlKeyringException:

Review Comment:
   I'll wrap them in `Credentials.save`, I'll check what that changes for the 
other places that call save



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to