I'm trying to create a new carbon user with wso2 v3.2.0 installed on docker, using scim2 endpoints.
When I try to issue a POST
request on /scim2/Users
endpoint, I always get a 401 Unauthorized
response even though properly authenticated with scopes.
- First, I create a token to authorize the admin user
curl --location --request POST 'https://<ip>:9443/oauth2/token' \
--header 'Authorization: Basic Q2J2RFg2bTJHTldaWGlyeklTMHFUVVd2VkVRYTpvNmZKMHRXeGFmekVqQ3hFVDBCMTA2d000ZUlh' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=admin' \
--data-urlencode 'password=admin' \
--data-urlencode 'scope=internal_user_mgt_create'
And I receive my token
{
"access_token": "9f368c42-2f75-3c20-b55b-08d7c0431a9e",
"refresh_token": "281a36d8-4ccd-3ef9-957c-d4db802fbbab",
"scope": "default internal_user_mgt_create",
"token_type": "Bearer",
"expires_in": 2413
}
- Then I issue my request to create a new User
curl --location --request POST 'https://<ip>:9443/t/wso2/scim2/Users' \
--header 'Authorization: Bearer 9f368c42-2f75-3c20-b55b-08d7c0431a9e' \
--header 'Content-Type: application/scim+json' \
--header 'Accept: application/scim+json' \
--data-raw '{
"schemas": [],
"name": {
"givenName": "Kim",
"familyName": "Berry"
},
"userName": "kim",
"password": "abc123",
"emails": [
{
"type": "home",
"value": "kim@gmail.com",
"primary": true
},
{
"type": "work",
"value": "kim@wso2.com"
}
]
}'
But I always get this response
Error 401 - Unauthorized
How can I resolve this?