Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Why I am getting Status 401 in response of an API request?

Avatar

Avatar
Boost 3
Level 2
madhavimaheshwari
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Give Back 3
Give Back
Ignite 1
Boost 1
View profile

Avatar
Boost 3
Level 2
madhavimaheshwari
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Give Back 3
Give Back
Ignite 1
Boost 1
View profile
madhavimaheshwari
Level 2

27-04-2021

I am using a sandbox environment for aem. I want to use rest API of AEM and while using them on chrome browser I am getting a json response but while using those APIs in postman I am getting status 401 Unauthorized in response and body part of response is blank. In response headers I am getting  www-authenticate header as Basic realm="Sling (Development)". I have matched username and password in authorization parameter that is correct.

madhavimaheshwari_0-1619584751808.png

 

Replies

Avatar

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

551 likes

Total Posts

663 posts

Correct Reply

191 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

551 likes

Total Posts

663 posts

Correct Reply

191 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile
asutosh_jena
Level 10

27-04-2021

Hi @madhavimaheshwari 

 

While making the request from postman you need to select Authorization type as "Basic Auth" and need to pass the username and password. Once you pass these information and make the request it will return 200 response and will no more give 401.

 

asutosh_jena_0-1619538911518.png

 

Thanks!

Avatar

Avatar
Boost 3
Level 2
madhavimaheshwari
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Give Back 3
Give Back
Ignite 1
Boost 1
View profile

Avatar
Boost 3
Level 2
madhavimaheshwari
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Give Back 3
Give Back
Ignite 1
Boost 1
View profile
madhavimaheshwari
Level 2

27-04-2021

Hi @asutosh_jena . I am doing that and username and passwords are also correct but still it is showing Status 401

madhavimaheshwari_0-1619584694696.png

 

Avatar

Avatar
Validate 1
MVP
Nikhil-Kumar
MVP

Likes

243 likes

Total Posts

256 posts

Correct Reply

38 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
MVP
Nikhil-Kumar
MVP

Likes

243 likes

Total Posts

256 posts

Correct Reply

38 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
Nikhil-Kumar
MVP

28-04-2021

@madhavimaheshwari - I think the authorization issue is because of the login creds but if you are already providing that can you try adding the content type as JSON and try hitting it again?

Avatar

Avatar
Boost 3
Level 2
madhavimaheshwari
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Give Back 3
Give Back
Ignite 1
Boost 1
View profile

Avatar
Boost 3
Level 2
madhavimaheshwari
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Give Back 3
Give Back
Ignite 1
Boost 1
View profile
madhavimaheshwari
Level 2

28-04-2021

Hi @Nikhil-Kumar

I am doing that but still issue persists.

madhavimaheshwari_0-1619596374642.png

 

Can we have a quick connect to solve this issue?

Avatar

Avatar
Boost 3
Level 2
madhavimaheshwari
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Give Back 3
Give Back
Ignite 1
Boost 1
View profile

Avatar
Boost 3
Level 2
madhavimaheshwari
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Give Back 3
Give Back
Ignite 1
Boost 1
View profile
madhavimaheshwari
Level 2

04-05-2021

I am still stuck with the same issue. We have tried all the possible ways as suggested in some of the answers but still facing the same issue. Can anyone please help?

 

Avatar

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

551 likes

Total Posts

663 posts

Correct Reply

191 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

551 likes

Total Posts

663 posts

Correct Reply

191 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile
asutosh_jena
Level 10

04-05-2021

Hi @madhavimaheshwari 

I see you are making a GET call while passing the credentials. You need to make the POST call and it will resolve the issue.

The same thing i have mentioned earlier in my above post as well.

Avatar

Avatar
Boost 3
Level 2
madhavimaheshwari
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Give Back 3
Give Back
Ignite 1
Boost 1
View profile

Avatar
Boost 3
Level 2
madhavimaheshwari
Level 2

Likes

4 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Give Back 3
Give Back
Ignite 1
Boost 1
View profile
madhavimaheshwari
Level 2

04-05-2021

Hi @asutosh_jena . I have tried all the methods like put, post, get but still getting this issue

Avatar

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

551 likes

Total Posts

663 posts

Correct Reply

191 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

551 likes

Total Posts

663 posts

Correct Reply

191 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile
asutosh_jena
Level 10

04-05-2021

HI @madhavimaheshwari 

 

Try with only the below parameters with GET request. select Authorization type as "Basic Auth" and provide the credentials.

remove www-authenticate header.

asutosh_jena_0-1620197631516.png