Keyrock に 2 人のユーザーを登録しました ( https://account.lab.fiware.orgのグローバル fiware labs インスタンス) 。
- ユーザー Robin には組織 Robin-Cloud があります
- ユーザー Robin はアプリケーション Babbler の所有者です
- アプリケーション Babbler には、ユーザー "Robin" と "Robin viewer" が承認されています (スクリーンショットを参照)。
- ユーザー「Robin viewer」は、ユーザー「Robin」と同じ組織のメンバーです
- 念のため、「ロビンビューアー」が所属する組織全体を承認しました。
- 両方のユーザーが同じロールを持っています。
シェル スクリプトを使用してユーザー「Robin」を認証し、アクセス トークンを取得できます。シェル スクリプトでは、アプリケーションのクライアント ID とクライアント シークレットを渡します。また、ユーザー「Robin」のユーザー名とパスワードも渡します。シェル スクリプトは次のとおりです (このhttps://raw.githubusercontent.com/Bitergia/fiware-chanchan-docker/master/images/pep-wilma/4.3.0/auth-token.shの変更されたコピー):
#!/bin/bash
if [ $# -lt 2 ] ; then
echo "auth-token: missing parameters."
echo "Usage: auth-token <user-email> <password>"
exit 1
fi
# Retrieve X-Auth-Token to make request against the protected resource
function get_token () {
if [ $# -lt 2 ] ; then
echo "get_token: missing parameters."
echo "Usage: get_token <user-email> <password>"
exit 1
fi
local _user=$1
local _pass=$2
# Retrieve Client ID and client Secret Automatically
CLIENT_ID="e2c095aa42414e75b9ac4d760f4c625a"
CLIENT_SECRET="****"
# Generate the Authentication Header for the request
AUTH_HEADER="$(echo -n ${CLIENT_ID}:${CLIENT_SECRET} | base64)"
# Define headers
CONTENT_TYPE="\"Content-Type: application/x-www-form-urlencoded\""
AUTH_BASIC="\"Authorization: Basic ${AUTH_HEADER}\""
# Define data to send
DATA="'grant_type=password&username=${_user}&password=${_pass}&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}'"
# Create the request
REQUEST="curl -s --insecure -i --header ${AUTH_BASIC} --header ${CONTENT_TYPE} -X POST https://account.lab.fiware.org/oauth2/token -d ${DATA}"
XAUTH_TOKEN="$(eval ${REQUEST})"
echo "Request: ${REQUEST}"
echo "X-Auth-Token for '${_user}': ${XAUTH_TOKEN}"
}
get_token $1 $2
でも
ユーザー「Robin viewer」のアクセストークンが取得できません。Keyrock からのメッセージは次のとおりです。
{"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}
Keyrock ユーザー インターフェイスで Babbler アプリのユーザー「Robin viewer」を承認するだけで十分だと思いました。ここで何が欠けていますか?