authorization on google appengine application
-
27-09-2019 - |
Question
Please, help. How can I validate user's group membership? Only users of a few google groups can access some pages on the site on appengine (python).
validating group membership gives a negative answer to my question, but it was a year ago, maybe something has changed..
Solution
There's currently no Google Groups API, and thus no way to determine if a user is a member of a Google Group.
OTHER TIPS
May be late but just for others who find this, here's my solution to this:
Create a new AppScript in drive which you then publish as webservice, you can use something like following code to check if a user is in the group or not:
// General context variables
var group = GroupsApp.getGroupByEmail("xxxx-group-name@googlegroups.com");
function doGet(request) {
var result = {
authorized: group.hasUser(request.parameter.mail)
};
return ContentService.createTextOutput(JSON.stringify(result)).setMimeType(ContentService.MimeType.JSON);
}
After publishing it, you will get a url which you can access, just append ?mail=user@domain.com to query group membership for the specific email address.