Search code examples
google-admin-sdkgoogle-workspace

How to retrieve all 3rd party apps in Google workspace / Google admin SDK using API?


I'm trying to retrieve all the 3rd party connected apps in my Google workspace admin SDK using API. Does anybody know how?


Solution

  • The Google Admin SDK doesn't have a method that only retrieves the 3rd party connected apps, but you could use the method activities.list using applicationName=token once you have the Oauth tokens you can filter out third party applications based on the product_bucket .

    =========

    Edit:

    You could try this example on App Script, that will display the token authorized for your users in the organization.

    function myFunction() {
      let request = {
        "eventName": "authorize"
      };
      let appsList = [];
      let response = AdminDirectory.Activities.list("all", "token", request);
      for(let i=0; i< response.items.length; i++)
      {
        if(appsList.includes(response.items[i].events[0].parameters[1].value)==false)
        {
          appsList.push(response.items[i].events[0].parameters[1].value);
        }
      }
      Logger.log(appsList);
    }
    

    ======

    Before you run the code remember to add the advance service Admin SDK

    enter image description here

    Then, change the Version to Reports_v1

    enter image description here

    References: