I'm very familiar with REST services and have just started with Google Endpoints.
I have the following class:
@Api(
name = "events",
version = "v1"
)
public class EventEndpoint {
@ApiMethod(
name = "events.get.all",
path = "get",
httpMethod = HttpMethod.GET
)
// http://localhost:8888/_ah/api/events/v1/get
public List<Event> getEvents() {
return new EventDao().findAll();
}
}
which returns the following json:
{
"items" : [ {
"id" : "1",
"version" : 1
}, {
"id" : "2",
"version" : 1
} ]
}
Now - what I'm wondering is - if I change the Api method to include the following:
@Api(
...
scopes = {"https://www.googleapis.com/auth/userinfo.email"}
and add a User object to my getEvents method, is there any way I can simply access it in the browser as a logged in Google User. Currently when I step through it with a debugger the User object is null.
I'm not (obviously) super familiar with how this works - I plan to put an AngularJS front end on this, get a token like the link here: https://developers.google.com/appengine/docs/java/endpoints/consume_js#adding-oath-authentication, but I'd like to at least be able to test my web services in the browser. Is this currently possible? This may be a simple question I'm just having problems finding out how to do it.
Thank you