Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

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

Avatar

Level 2

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

 

11 Replies

Avatar

Community Advisor

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

Level 2

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

Community Advisor

@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

Level 2

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

Level 2

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

Community Advisor

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.

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

Avatar

Community Advisor

@sriram_1 


Are you using the local login i.e., username or password or using the adobe credentials that was used to login using cloud manager?

This is basic authentication so it will work only if you are using local login credentials for cloud. It works for me from postman. Let me know if it does not work.

 

Thanks,

Asutosh

Avatar

Level 1

I'm experiencing this same issue. I am using the credentials that log me into cloud manager but what is the difference? How can I find out my local credentials?

I know that i set different credentials when i was deploying an exporter but i have tried using those credentials, too and I still get the same 401 error.

Avatar

Community Advisor

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