Hi,
I want to add a user as a direct member to a group via rest API.
I'm using crowd admin for authorization (basic mode). But the result is: Application failed to authenticate! "401".
I can log in to crowd using crowd admin username and password. I don't know how to fix this status.
Any suggestion?
curl --location --request POST 'https://localhost/crowd/rest/usermanagement/1/group/user/direct?groupname=samplegroup' \--header 'Authorization: Basic username&password' \--header 'Content-Type: application/json'\ --data-raw '{"name": "sampleuser"}'
Same error
401 Unauthorized
Application failed to authenticate
using Crowd REST API https://docs.atlassian.com/atlassian-crowd/5.1.0/REST/#usermanagement/1/group-addUserAsDirectGroupMember.
Credentials are correct since other Crowd REST APIs work as expected.
Any advice?
Thanks in advance.
Cheers.
Gotcha!
Please note that the
usermanagement
resource expects the callers to authenticate using the application credentials (i.e. the application name and password configured in Crowd). Calls to this APIs are restricted by IP as configured.Other resources expect the callers to authenticate using the user credentials.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wrote a wrapper in Rust as well as leveraged ScriptRunner and HttpURLConnection to do REST API calls with our Crowd instance. In the base formatting for my json and URL looked similar to below:
URL:
http://crowdBaseUrl/crowd/rest/usermanagement/latest/user/group/direct?username="user unique ID"
JSON:
"{"name": "NAME OF GROUP", "description": "LEFT BLANK", "type": "GROUP", "active": "true"}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
URL:
http://crowdBaseUrl/crowd/rest/usermanagement/latest/user/group/direct?username="user unique ID"
JSON:
"{"name": "NAME OF GROUP", "description": "LEFT BLANK", "type": "GROUP", "active": "true"}"
So, Crowd REST API https://docs.atlassian.com/atlassian-crowd/5.1.0/REST/#usermanagement/1/user-addUserToGroup is working for you?
Thanks in advance.
Cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeap! Been working since we deployed the applet to do the group assignments! Is yours not? Have you manually executed the REST API call in the browser to validate that you're hitting the API correctly?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The username password you're using is the application username password correct? These are defined as applications in crowd, not as users in crowd.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Penn , thanks for your answer. I am using Crowd Admin User (internal user!)
What is Application username exactly?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Parvaneh Zand when you look at your crowd installation, in the web interface you have "Applications" at the top. Within Applications you define each application and the access controls for the application. The "Name" in each application as well as the "Password" for that application are what I'm referring to. I believe these are the access control values you need to be supplying.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same problem, any solution found?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.