auth-login コマンド
auth-login
指定されたプロファイルの接続情報でAPCプラットフォームから認証を受け、アクセストークンを取得してローカルに保存します。 保存したトークンは、後続のAPI呼び出しの際に使用されます。
認証の前提条件
認証を行う前に、apc configureによる設定 が完了している必要があります。
使用方法
apc auth-login --profile <プロファイル名>
例
apc auth-login --profile acompany
引数
なし
オプション
- --profile <プロファイル名>
認証情報のプロファイル名を指定します。
正常終了時の出力例
$ apc auth-login --profile acompany
Login for Profile: acompany success!
異常終了時の出力例
# 認証情報が間違っている場合
$ apc auth-login --profile acompany
AuthenticationError: Failed to authenticate: Invalid client credentials
# 存在しないプロファイルを指定した場合
$ apc auth-login --profile nonexistent_profile
NotFoundError: Profile 'nonexistent_profile' not found
# サーバー接続エラーの場合
$ apc auth-login --profile acompany
NetworkError: Failed to authenticate: Connection failed to authentication server
# アクセストークン取得エラーの場合
$ apc auth-login --profile acompany
AuthenticationError: Failed to authenticate: Token endpoint returned error
トークンの有効期限
アクセストークンの有効期限が切れ、API呼び出し時にエラーが発生した場合は再認証を実行してください。