0

I successfully implemented Google Sign-in button where I log in using Gmail accounts from a hosted domain (HD) of mine: with Javascript I retrieve user's data, but the only infos about his/her HD is just the name (by using getHostedDomain()).

So I made a Service Account in order to get more infos about my HD (using Python API): by using HD name, I retrieve groups and members of the HD.

So far so good, but the process of information collection is not one: it is splitted in two different files executed at different times. For now, I sign-in with a Gmail account on a web page and I take note of the HD returned to which the logged user belongs; then I run my Python script in a terminal that examines the given HD name in order to retrieve groups and members.

I'm trying to implement a single execution collector where only a file is executed and possibly only one language is used: the web page is the file I cannot give up since I'd like to offer Google Sign-in, so I'm trying to access other HD infos (besides its name) from the web page with Javascript, without using my other Python script.

Is it possible to retrieve everything only using Javascript?

elmazzun
  • 1,066
  • 2
  • 18
  • 44
  • I think what you are looking for is to [retrieve all groups for a domain or the account](https://developers.google.com/admin-sdk/directory/v1/guides/manage-groups#get_all_domain_groups). Also to retrieve the data you needed for a specific user, you can use the method [Users: get](https://developers.google.com/admin-sdk/directory/v1/reference/users/get), – MαπμQμαπkγVπ.0 Mar 14 '18 at 11:13
  • @MαπμQμαπkγVπ.0 You are right, I found everything I needed: post your comment as an answer and I'll accept it. – elmazzun Mar 14 '18 at 12:51
  • Good to know that it helped you. – MαπμQμαπkγVπ.0 Mar 15 '18 at 02:46

1 Answers1

0

I think what you are looking for is to retrieve all groups for a domain or the account. Also to retrieve the data you needed for a specific user, you can use the method Users: get.

MαπμQμαπkγVπ.0
  • 5,887
  • 1
  • 27
  • 65
  • Would you edit your answer in order to add some clarifications and further help future reader of this answer? Here they are: https://developers.google.com/admin-sdk/directory/v1/reference/ is the interesting page: click on the left column some resource tutorial, on top click "Try it now.", on the right appears "Try this API", click on top right the expand symbol (now Try this API should be centered and bigger) and click on Javascript tab in order to finally find out a working example in Javascript. – elmazzun Mar 15 '18 at 09:13