Search code examples
google-admin-sdk

Retrieve connected applications for an user on google admin


On the security part of an account details we can find the Connected applications section where all the third-party applications are listed.

How can I retrieve this list via the API ou SDK ?

enter image description here


Solution

  • You can use the Reports API tokens.list. This returns a list of all active tokens (or connected apps) for a particular user. The resource looks something like this:

      "items": [
        {
          "kind": "admin#directory#token",
          "etag": "...",
          "clientId": "...apps.googleusercontent.com",
          "displayText": "Some app",
          "anonymous": false,
          "nativeApp": false,
          "userKey": "...",
          "scopes": [
            "https://mail.google.com/",
            "..."
          ]
        }
      ]
    

    And just like the Admin console menu in your screenshot you can also revoke the tokens for each user by using tokens.delete.

    Reference: