Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,027
Community Members
 
Community Events
184
Community Groups

Add user to group - Crowd Rest API

Edited
Parvaneh Zand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 28, 2020

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"}'

 

4 answers

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. 

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"}"

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.

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?

The username password you're using is the application username password correct? These are defined as applications in crowd, not as users in crowd.

Parvaneh Zand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Apr 05, 2023

Hi @Penn , thanks for your answer. I am using Crowd Admin User (internal user!)

What is Application username exactly?

@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.

I have the same problem, any solution found?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events