spring - REST API called from Client Web with error -


i have rest api , web client. in web client call rest api :

public string logon(string token) {     string url = clientrootconfig.returnwebtarget() + "/emot/login";     httpheaders headers = new httpheaders();     headers.add("authorization", "basic " + token);     httpentity<string> request = new httpentity<string>(headers);     responseentity<string> response = resttemplate.exchange(url, httpmethod.post, request, string.class);     return "test"; } 

when provide bad cretentials, have error message on page :

rg.springframework.web.client.httpclienterrorexception: 403 null     @ org.springframework.web.client.defaultresponseerrorhandler.handleerror(defaultresponseerrorhandler.java:91)     @ org.springframework.web.client.resttemplate.handleresponse(resttemplate.java:700)     @ org.springframework.web.client.resttemplate.doexecute(resttemplate.java:653)     @ org.springframework.web.client.resttemplate.execute(resttemplate.java:613)     @ org.springframework.web.client.resttemplate.exchange(resttemplate.java:531)     @ com.myapp.clientweb.facade.implementation.connectionserviceimpl.logon(connectionserviceimpl.java:38)     @ com.myapp.clientweb.requestmapper.dashboard.postlogin(dashboard.java:64) 

but when check postman have resposne expected :

{"cause":"required full authorization","code":401} 


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -