0
0

More than 3 years have passed since last update.

aws cli v2.0系でSSO Loginしaws-sdk-goでその情報を使おうとするとエラーになる

Posted at

利用したバージョン

# エラーが発生したバージョン
$ aws --version
aws-cli/2.0.48 Python/3.7.2 Darwin/20.3.0 source/x86_64

# 問題なく実行できたバージョン
$ aws --version
aws-cli/2.1.30 Python/3.8.8 Darwin/20.3.0 exe/x86_64 prompt/off

# go.mod
github.com/aws/aws-sdk-go v1.37.28

aws-sdk-goのエラー内容

failed to fetch configuration: SSOProviderInvalidToken: the SSO session has expired or is invalid
caused by: expected RFC3339 timestamp: parsing time "2021-03-11T19:47:52UTC" as "2006-01-02T15:04:05Z07:00": cannot parse "UTC" as "Z07:00"
exit status 3

解消方法

  • aws cliのバージョンをv2.0系からv2.1系にアップグレードすると問題なく実行できました。

問題のCacheを実際に見てみた

  • ファイルの場所は ~/.aws/sso/cache/*.json のいずれか

aws cli v2.0系の場合

{
    "accessToken": "abcdefghijk...",
    "expiresAt": "2021-03-11T19:47:52UTC",  ←ここが問題
    "region": "us-east-1",
    "startUrl": "https://d-1234.awsapps.com/start"
}

aws cli v2.1系の場合

{
    "accessToken": "abcdefghijk...",
    "expiresAt": "2021-03-11T20:36:54Z",   ←ここが変わった
    "region": "us-east-1",
    "startUrl": "https://d-1234.awsapps.com/start"
}

関連URL

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0