2015-11-04 68 views
1

我可以从Android调用所有Web服务,但节点服务器无法识别我的会话。我想我必须通过令牌进行身份验证,同时从Android调用Web服务。我使用以下代码登录:Angular Rest API with android

HttpPost httpget = new HttpPost("https://xyz/signIn");  
HttpResponse response = MainActivity.httpclient.execute(httpget); 
HttpEntity entity = response.getEntity(); 

在节点服务器上使用Express会话管理。

回答

0

必须设置令牌在请求头:

httpget.addHeader("Authorization", new StringBuilder("Bearer ").append(accessToken).toString());