0
url = new URL("https://blb-test.morulabs.com/api/fetch/cosmetics/");
            HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Authorization", token);

Is it correct to put the token value like that in the requestproperty for token authentication to communicate with the server? 400 Communication Error

박주현
  • 1
  • 2

1 Answers1

0

I can't add this answer as a comment (not enough reputation).

Similar question was answered in here.

If you authentication was failing, I would expected a 401 error, instead of 400 you received. The 400 error means that a the peer received something unexpected. More information can be checked in here.

You must check with the peer to understand what is the correct way to pass this attributes to them.

hess
  • 76
  • 5