I'm trying to access an express.js api done with node.js and passport.js. Some methods just work when req.use is available.
I try to log with facebook and twitter from my client app, and I get plain cookie.
Something like connect.sid=jkbsdkjabdkjasdbjkadnaidiadiasdaoidoa
I recreate the client cookie with this method:
BasicClientCookie clientCookie = new BasicClientCookie(Metadata.COOKIE_LOGIN, cookieValue);
clientCookie.setDomain("www.domain.com");
clientCookie.setPath("/");
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, 1);
clientCookie.setExpiryDate(calendar.getTime());
return clientCookie;
And after that I make Json Requests with this:
HttpUriRequest request = method.createRequest(uri);
request.addHeader("Accept", "application/json");
HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);
DefaultHttpClient client = new DefaultHttpClient(params);
client.getCookieStore().addCookie(USER_SESSION_COOKIE);
HttpResponse response = client.execute(request);
String serializedJson = EntityUtils.toString(response.getEntity(), HTTP.UTF_8);
T fromJson = gsonParser.fromJson(serializedJson, clazz);
I cannot get on express' routes methods the user as usual.
I know that I'm doing something wrong but I don't know what.
Anyone has done a connection betweem an android app and passport.js?
Thank you all!