基于android的角度restapi
我可以从Android调用所有web服务,但是节点服务器无法识别我的会话。我想我必须在从Android调用web服务时传递令牌以进行身份验证。我正在使用以下代码登录:基于android的角度restapi,android,angularjs,Android,Angularjs,我可以从Android调用所有web服务,但是节点服务器无法识别我的会话。我想我必须在从Android调用web服务时传递令牌以进行身份验证。我正在使用以下代码登录: HttpPost httpget = new HttpPost("https://xyz/signIn"); HttpResponse response = MainActivity.httpclient.execute(httpget); HttpEntity entity = response.getEntity()
HttpPost httpget = new HttpPost("https://xyz/signIn");
HttpResponse response = MainActivity.httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
在节点服务器上使用Express会话管理 您必须在请求头中设置令牌:
httpget.addHeader("Authorization", new StringBuilder("Bearer ").append(accessToken).toString());
您必须在请求的标头中设置令牌:
httpget.addHeader("Authorization", new StringBuilder("Bearer ").append(accessToken).toString());