0

I am trying to read out the HTTP Cookies from AppEngine Endpoints method:

@ApiMethod(httpMethod = "get")
public void getAll(HttpServletRequest req) {

    log.info("req: " + req);

    Cookie[] cookies = req.getCookies();
    for (Cookie cookie : cookies) {
        log.info("cookie: " + cookie.getName() + " " + cookie.getValue());
    }


}

But no matter what i try, the cookies are NULL. Any ideas? It should work in this way: http://chirashi.zenconsult.net/2013/07/custom-authentication-with-google-cloud-endpoints-using-app-engine-java

jens
  • 53
  • 5
  • If I run this application on localhost, the cookies are not deleted. It's strange... – jens Sep 07 '13 at 12:24

2 Answers2

2

Something like this seems to work for me. I have tested it right on App Engine.

@Api(name = "api_name", version = "v1", description = "An API", auth = @ApiAuth(allowCookieAuth = AnnotationBoolean.TRUE))
David
  • 1,510
  • 20
  • 16
1

It doesn't seem to work with Java. There's a bug filed here: https://code.google.com/p/googleappengine/issues/detail?id=10100

With Python, cookies aren't passed through by default but there is a way to enable them. I think this annotation is meant to do the same in Java but doesn't seem to do anything:

@ApiAuth(allowCookieAuth = AnnotationBoolean.TRUE) 
Community
  • 1
  • 1
BrianHenryIE
  • 520
  • 5
  • 12