1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS CLI で Cognito User Pool アプリクライアントの callback urls, logout urls 設定しようとすると変なエラーになる問題

Posted at

解決策

--callback-urls '["https://www.example.com"]' みたいな形式で指定すれば OK

ミニマムなコマンド例

$ aws cognito-idp create-user-pool-client --user-pool-id ap-northeast-1_xxx --client-name myclient --callback-urls '["https://www.example.com"]'
{
    "UserPoolClient": {
        "UserPoolId": "ap-northeast-1_xxx",
        "ClientName": "myclient",
        "ClientId": "yyy",
        "LastModifiedDate": 1565704189.827,
        "CreationDate": 1565704189.827,
        "RefreshTokenValidity": 30,
        "CallbackURLs": [
            "https://www.example.com"
        ],
        "AllowedOAuthFlowsUserPoolClient": false
    }
}

どういう事?

AWS CLI のリファレンスを見てみる。

create-user-pool-client — AWS CLI 1.16.216 Command Reference
https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/create-user-pool-client.html

--callback-urls (list)

A list of allowed redirect (callback) URLs for the identity providers.

A redirect URI must:

    Be an absolute URI.
    Be registered with the authorization server.
    Not include a fragment component.

See OAuth 2.0 - Redirection Endpoint .

Amazon Cognito requires HTTPS over HTTP except for http://localhost for testing purposes only.

App callback URLs such as myapp://example are also supported.

Syntax:

"string" "string" ...

--callback-urls は list で指定しましょうね的な事が書いてある。
では、その通り指定してみる。

$ aws cognito-idp create-user-pool-client --user-pool-id ap-northeast-1_xxx --client-name myclient --callback-urls "https://www.example.com"

An error occurred (InvalidParameterException) when calling the CreateUserPoolClient operation: 2 validation errors detected: Value '[<, !, d, o, c, t, y, p, e,  , h, t, m, l, >, 
, <, h, t, m, l, >, 
, <, h, e, a, d, >, 
,  ,  ,  ,  , <, t, i, t, l, e, >, E, x, a, m, p, l, e,  , D, o, m, a, i, n, <, /, t, i, t, l, e, >, 
, 
,  ,  ,  ,  , <, m, e, t, a,  , c, h, a, r, s, e, t, =, ", u, t, f, -, 8, ",  , /, >, 
,  ,  ,  ,  , <, m, e, t, a,  , h, t, t, p, -, e, q, u, i, v, =, ", C, o, n, t, e, n, t, -, t, y, p, e, ",  , c, o, n, t, e, n, t, =, ", t, e, x, t, /, h, t, m, l, ;,  , c, h, a, r, s, e, t, =, u, t, f, -, 8, ",  , /, >, 
,  ,  ,  ,  , <, m, e, t, a,  , n, a, m, e, =, ", v, i, e, w, p, o, r, t, ",  , c, o, n, t, e, n, t, =, ", w, i, d, t, h, =, d, e, v, i, c, e, -, w, i, d, t, h, ,,  , i, n, i, t, i, a, l, -, s, c, a, l, e, =, 1, ",  , /, >, 
,  ,  ,  ,  , <, s, t, y, l, e,  , t, y, p, e, =, ", t, e, x, t, /, c, s, s, ", >, 
,  ,  ,  ,  , b, o, d, y,  , {, 
,  ,  ,  ,  ,  ,  ,  ,  , b, a, c, k, g, r, o, u, n, d, -, c, o, l, o, r, :,  , #, f, 0, f, 0, f, 2, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , m, a, r, g, i, n, :,  , 0, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , p, a, d, d, i, n, g, :,  , 0, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , f, o, n, t, -, f, a, m, i, l, y, :,  , ", O, p, e, n,  , S, a, n, s, ", ,,  , ", H, e, l, v, e, t, i, c, a,  , N, e, u, e, ", ,,  , H, e, l, v, e, t, i, c, a, ,,  , A, r, i, a, l, ,,  , s, a, n, s, -, s, e, r, i, f, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , 
,  ,  ,  ,  , }, 
,  ,  ,  ,  , d, i, v,  , {, 
,  ,  ,  ,  ,  ,  ,  ,  , w, i, d, t, h, :,  , 6, 0, 0, p, x, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , m, a, r, g, i, n, :,  , 5, e, m,  , a, u, t, o, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , p, a, d, d, i, n, g, :,  , 5, 0, p, x, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , b, a, c, k, g, r, o, u, n, d, -, c, o, l, o, r, :,  , #, f, f, f, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , b, o, r, d, e, r, -, r, a, d, i, u, s, :,  , 1, e, m, ;, 
,  ,  ,  ,  , }, 
,  ,  ,  ,  , a, :, l, i, n, k, ,,  , a, :, v, i, s, i, t, e, d,  , {, 
,  ,  ,  ,  ,  ,  ,  ,  , c, o, l, o, r, :,  , #, 3, 8, 4, 8, 8, f, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , t, e, x, t, -, d, e, c, o, r, a, t, i, o, n, :,  , n, o, n, e, ;, 
,  ,  ,  ,  , }, 
,  ,  ,  ,  , @, m, e, d, i, a,  , (, m, a, x, -, w, i, d, t, h, :,  , 7, 0, 0, p, x, ),  , {, 
,  ,  ,  ,  ,  ,  ,  ,  , b, o, d, y,  , {, 
,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , b, a, c, k, g, r, o, u, n, d, -, c, o, l, o, r, :,  , #, f, f, f, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , }, 
,  ,  ,  ,  ,  ,  ,  ,  , d, i, v,  , {, 
,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , w, i, d, t, h, :,  , a, u, t, o, ;, 
,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , m, a, r, g, i, n, :,  , 0,  , a, u, t, o, ;, 
,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , b, o, r, d, e, r, -, r, a, d, i, u, s, :,  , 0, ;, 
,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , p, a, d, d, i, n, g, :,  , 1, e, m, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , }, 
,  ,  ,  ,  , }, 
,  ,  ,  ,  , <, /, s, t, y, l, e, >,  ,  ,  ,  , 
, <, /, h, e, a, d, >, 
, 
, <, b, o, d, y, >, 
, <, d, i, v, >, 
,  ,  ,  ,  , <, h, 1, >, E, x, a, m, p, l, e,  , D, o, m, a, i, n, <, /, h, 1, >, 
,  ,  ,  ,  , <, p, >, T, h, i, s,  , d, o, m, a, i, n,  , i, s,  , e, s, t, a, b, l, i, s, h, e, d,  , t, o,  , b, e,  , u, s, e, d,  , f, o, r,  , i, l, l, u, s, t, r, a, t, i, v, e,  , e, x, a, m, p, l, e, s,  , i, n,  , d, o, c, u, m, e, n, t, s, .,  , Y, o, u,  , m, a, y,  , u, s, e,  , t, h, i, s, 
,  ,  ,  ,  , d, o, m, a, i, n,  , i, n,  , e, x, a, m, p, l, e, s,  , w, i, t, h, o, u, t,  , p, r, i, o, r,  , c, o, o, r, d, i, n, a, t, i, o, n,  , o, r,  , a, s, k, i, n, g,  , f, o, r,  , p, e, r, m, i, s, s, i, o, n, ., <, /, p, >, 
,  ,  ,  ,  , <, p, >, <, a,  , h, r, e, f, =, ", h, t, t, p, :, /, /, w, w, w, ., i, a, n, a, ., o, r, g, /, d, o, m, a, i, n, s, /, e, x, a, m, p, l, e, ", >, M, o, r, e,  , i, n, f, o, r, m, a, t, i, o, n, ., ., ., <, /, a, >, <, /, p, >, 
, <, /, d, i, v, >, 
, <, /, b, o, d, y, >, 
, <, /, h, t, m, l, >, 
]' at 'callbackURLs' failed to satisfy constraint: Member must have length less than or equal to 100; Value '[<, !, d, o, c, t, y, p, e,  , h, t, m, l, >, 
, <, h, t, m, l, >, 
, <, h, e, a, d, >, 
,  ,  ,  ,  , <, t, i, t, l, e, >, E, x, a, m, p, l, e,  , D, o, m, a, i, n, <, /, t, i, t, l, e, >, 
, 
,  ,  ,  ,  , <, m, e, t, a,  , c, h, a, r, s, e, t, =, ", u, t, f, -, 8, ",  , /, >, 
,  ,  ,  ,  , <, m, e, t, a,  , h, t, t, p, -, e, q, u, i, v, =, ", C, o, n, t, e, n, t, -, t, y, p, e, ",  , c, o, n, t, e, n, t, =, ", t, e, x, t, /, h, t, m, l, ;,  , c, h, a, r, s, e, t, =, u, t, f, -, 8, ",  , /, >, 
,  ,  ,  ,  , <, m, e, t, a,  , n, a, m, e, =, ", v, i, e, w, p, o, r, t, ",  , c, o, n, t, e, n, t, =, ", w, i, d, t, h, =, d, e, v, i, c, e, -, w, i, d, t, h, ,,  , i, n, i, t, i, a, l, -, s, c, a, l, e, =, 1, ",  , /, >, 
,  ,  ,  ,  , <, s, t, y, l, e,  , t, y, p, e, =, ", t, e, x, t, /, c, s, s, ", >, 
,  ,  ,  ,  , b, o, d, y,  , {, 
,  ,  ,  ,  ,  ,  ,  ,  , b, a, c, k, g, r, o, u, n, d, -, c, o, l, o, r, :,  , #, f, 0, f, 0, f, 2, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , m, a, r, g, i, n, :,  , 0, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , p, a, d, d, i, n, g, :,  , 0, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , f, o, n, t, -, f, a, m, i, l, y, :,  , ", O, p, e, n,  , S, a, n, s, ", ,,  , ", H, e, l, v, e, t, i, c, a,  , N, e, u, e, ", ,,  , H, e, l, v, e, t, i, c, a, ,,  , A, r, i, a, l, ,,  , s, a, n, s, -, s, e, r, i, f, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , 
,  ,  ,  ,  , }, 
,  ,  ,  ,  , d, i, v,  , {, 
,  ,  ,  ,  ,  ,  ,  ,  , w, i, d, t, h, :,  , 6, 0, 0, p, x, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , m, a, r, g, i, n, :,  , 5, e, m,  , a, u, t, o, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , p, a, d, d, i, n, g, :,  , 5, 0, p, x, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , b, a, c, k, g, r, o, u, n, d, -, c, o, l, o, r, :,  , #, f, f, f, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , b, o, r, d, e, r, -, r, a, d, i, u, s, :,  , 1, e, m, ;, 
,  ,  ,  ,  , }, 
,  ,  ,  ,  , a, :, l, i, n, k, ,,  , a, :, v, i, s, i, t, e, d,  , {, 
,  ,  ,  ,  ,  ,  ,  ,  , c, o, l, o, r, :,  , #, 3, 8, 4, 8, 8, f, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , t, e, x, t, -, d, e, c, o, r, a, t, i, o, n, :,  , n, o, n, e, ;, 
,  ,  ,  ,  , }, 
,  ,  ,  ,  , @, m, e, d, i, a,  , (, m, a, x, -, w, i, d, t, h, :,  , 7, 0, 0, p, x, ),  , {, 
,  ,  ,  ,  ,  ,  ,  ,  , b, o, d, y,  , {, 
,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , b, a, c, k, g, r, o, u, n, d, -, c, o, l, o, r, :,  , #, f, f, f, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , }, 
,  ,  ,  ,  ,  ,  ,  ,  , d, i, v,  , {, 
,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , w, i, d, t, h, :,  , a, u, t, o, ;, 
,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , m, a, r, g, i, n, :,  , 0,  , a, u, t, o, ;, 
,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , b, o, r, d, e, r, -, r, a, d, i, u, s, :,  , 0, ;, 
,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , p, a, d, d, i, n, g, :,  , 1, e, m, ;, 
,  ,  ,  ,  ,  ,  ,  ,  , }, 
,  ,  ,  ,  , }, 
,  ,  ,  ,  , <, /, s, t, y, l, e, >,  ,  ,  ,  , 
, <, /, h, e, a, d, >, 
, 
, <, b, o, d, y, >, 
, <, d, i, v, >, 
,  ,  ,  ,  , <, h, 1, >, E, x, a, m, p, l, e,  , D, o, m, a, i, n, <, /, h, 1, >, 
,  ,  ,  ,  , <, p, >, T, h, i, s,  , d, o, m, a, i, n,  , i, s,  , e, s, t, a, b, l, i, s, h, e, d,  , t, o,  , b, e,  , u, s, e, d,  , f, o, r,  , i, l, l, u, s, t, r, a, t, i, v, e,  , e, x, a, m, p, l, e, s,  , i, n,  , d, o, c, u, m, e, n, t, s, .,  , Y, o, u,  , m, a, y,  , u, s, e,  , t, h, i, s, 
,  ,  ,  ,  , d, o, m, a, i, n,  , i, n,  , e, x, a, m, p, l, e, s,  , w, i, t, h, o, u, t,  , p, r, i, o, r,  , c, o, o, r, d, i, n, a, t, i, o, n,  , o, r,  , a, s, k, i, n, g,  , f, o, r,  , p, e, r, m, i, s, s, i, o, n, ., <, /, p, >, 
,  ,  ,  ,  , <, p, >, <, a,  , h, r, e, f, =, ", h, t, t, p, :, /, /, w, w, w, ., i, a, n, a, ., o, r, g, /, d, o, m, a, i, n, s, /, e, x, a, m, p, l, e, ", >, M, o, r, e,  , i, n, f, o, r, m, a, t, i, o, n, ., ., ., <, /, a, >, <, /, p, >, 
, <, /, d, i, v, >, 
, <, /, b, o, d, y, >, 
, <, /, h, t, m, l, >, 
]' at 'callbackURLs' failed to satisfy constraint: Member must satisfy constraint: [Member must have length less than or equal to 1024, Member must have length greater than or equal to 1, Member must satisfy regular expression pattern: [\p{L}\p{M}\p{S}\p{N}\p{P}]+]

!?!?!?

https://www.example.com の内容が取得されてパラメーターとして指定されてそうな感じ。
一体何が起こっているのか・・・

AWS CLI 既知の問題

ズバリな GitHub Issue が。

Unable to update callback / logout urls via CLI · Issue #2894 · aws/aws-cli
https://github.com/aws/aws-cli/issues/2894

This is happening because the CLI supports loading params from remote files: http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-file-remote

It's on our backlog to have a way to disable this functionality, but in the meantime you can workaround this issue by specifying this value as JSON. Those two params are of type list, so you can use --callback-urls '["https://localhost"]' --logout-urls '["https://localhost"]' as a workaround for the time being.

CLI がリモートファイルからのパラメーター読み込みをサポートしているために発生しているらしい。
無効化オプションがバックログにはあるものの、当面はパラメーターを JSON 指定することで回避してくれ的な事が書いてあります。

--callback-urls--logout-urls も、 '["https://localhost"]' のような形で指定するワークアラウンドが有効。

これらを設定するコマンドは、 create-user-pool-clientupdate-user-pool-client

おわり

AWS CLI から Cognito User Pool アプリクライアントの --callback-urls, --logout-urls を設定することがあれば、'["https://localhost"]' のような形で指定すると良さそうです。

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?