2015-11-04 61 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());