Getting Error "Api Key is invalid"
I am trying to do some api calls to assign users to groups. It looks like I successfully get the access token, but when I run the following call, I get the error.
curl -X POST -H "Content-type: application/json" -H "Accept: application/json" -H "x-api-key: ${api_key}" -H "Authorization: Bearer ${access_token}" https://usermanagement.adobe.io/v2/usermanagement/action/${org_id}?testOnly=true
I get this error:
{"error_code":"403003","message":"Api Key is invalid"}
This one is successful which makes me think my api key and access token are good:
curl -X GET -H "Authorization: Bearer ${access_token}" "https://ims-na1.adobelogin.com/ims/userinfo/v2?client_id=${api_key}"
Here's the payload I'm using for my JWT:
{
"exp":${expiration},
"iss":"${org_id}",
"sub":"${tech_acct}",
"aud":"https://ims-na1.adobelogin.com/c/${api_key}",
"https://ims-na1.adobelogin.com/s/ent_adobeio_sdk":true
}
I think I have the correct metascope, but I'm not positive.
Ultimately, I want to use these:
#get list of all users
curl -X GET -H "Content-type: application/json" -H "Accept: application/json" -H "x-api-key: ${api_key}" -H "Authorization: Bearer ${access_token}" https://usermanagement.adobe.io/v2/usermanagement/users/${org_id}
#assign users to group
json='{
"usergroup": "GROUPNAME",
"do": [
{
"add": {
"user": [
"user1@myCompany.com"
]
}
}
]
}'
curl -X POST -H "Content-type: application/json" -H "Accept: application/json" -H "x-api-key: ${api_key}" -H "Authorization: Bearer ${access_token}" https://usermanagement.adobe.io/v2/action/${org_id} -d "${json}"
