Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Basic Authentication Failure - Reason : AUTHENTICATION_DENIED

rahul rajeev
Contributor
February 26, 2024

I am using Confluence data center to generate users invitation link using bash script

CONFLUENCE_URL="http://localhost:XXXX"
ENDPOINT= rest/invitation/1.0/invitation-link
USERNAME="admin"
API_TOKEN="XXXX"
    # Make POST request to create a new invitation link
    INVITE_RESPONSE=$(curl -s -u "${USERNAME}:${API_TOKEN}" -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \y
        -d '{"expirationDate": "2025-02-26T00:00:00.000Z"}' \
        "${CONFLUENCE_URL}/${ENDPOINT")
But getting authentication error

<!doctype html><html lang=en><head><title>HTTP Status 401 – Unauthorized</title><style type=text/css>body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 401 – Unauthorized</h1><hr class=line /><p><b>Type</b> Status Report</p><p><b>Message</b> Basic Authentication Failure - Reason : AUTHENTICATION_DENIED</p><p><b>Description</b> The request has not been applied because it lacks valid authentication credentials for the target resource.</p><hr class=line /><h3>Apache Tomcat/9.0.54</h3></body></html>

4 answers

2 votes
Marc - Devoteam
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.
February 26, 2024

Hi @rahul rajeev 

There is no invitation endpoint in the API.

You can create a user via the API and have them receive a notification.

See api related topic here: user-createUser 

 

Marc - Devoteam
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.
February 26, 2024

The only API that had this option was bitbucket.

https://support.atlassian.com/bitbucket-cloud/docs/invitations-resource/ 

But only in API version 1, and that removed since 2019

rahul rajeev
Contributor
February 26, 2024

Hi @Marc - Devoteam 

Thank You for your response.

Is there a way to regenerate user invitation link in confluence data center(8.5.5) automatically using bash script?

Marc - Devoteam
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.
February 27, 2024

Hi @rahul rajeev 

No there is none.

The only option is as I mentioned before, create the new users via the API and have the sent notification on "true".

1 vote
Humashankar VJ
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.
February 26, 2024

Hi - I hope that you are Doing good !!

Looks authentication credentials provided in your Bash script are not being accepted by Confluence Data Center

Kindly check the correctness of your credentials and ensure that the API token has been generated correctly and retry

Hope this helps and happy to assist further !!

Thank you very much and have a fantastic day!
Warm regards

rahul rajeev
Contributor
February 26, 2024

Thank you for your response.
But is the endpoint correct to generate the invitation link?

Like Humashankar VJ likes this
0 votes
Andrii Maliuta
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.
February 26, 2024

Hello @rahul rajeev ,

Do you get the 401 error for other REST API endpoints?

How did you get the 'rest/invitation/1.0/invitation-link' endpoint? It is not listed in the REST API docs https://docs.atlassian.com/ConfluenceServer/rest/8.8.0/ for COnfluence Data Center/Server.

 

rahul rajeev
Contributor
February 26, 2024

Hi @Andrii Maliuta 

Thank you for your response.

Someone told me I could use this endpoint to invite. Is there any other way to regenerate user invitation link in confluence data center(8.5.5) automatically using bash script?

Humashankar VJ
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.
February 26, 2024

Hi @rahul rajeev 

 

Endpoint is certainly used to create invitation links for users

This endpoint giving hard time and not supporting in the process regenerating invitation links for existing users automatically

Try to regenerate invitation links for existing users automatically using a bash script which is a bit complex approach while comparing toward the API endpoint.

 

At this time we can treat this as a first level conclusion !!

If you intend to move forward, we can also work towards it.

Warm regards

rahul rajeev
Contributor
February 26, 2024

Hi @Humashankar VJ 

Thank you for your response. But at this point I dont want to create for existing users.

I just want to generate new invitation links weekly for new users

0 votes
Humashankar VJ
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.
February 26, 2024

Yes - Endpoint looks perfect 

rahul rajeev
Contributor
February 26, 2024

The endpoint is not working and I couldnt find in the Confluence documentation

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events