code: private static Credential getCredentialFromAccessTokenProvider(
        AccessTokenProvider accessTokenProvider, Collection<String> scopes)
        throws IOException, GeneralSecurityException {
      Preconditions.checkArgument(
          accessTokenProvider.getAccessToken() != null, "Access Token cannot be null!");
      GoogleCredential credential =
          GoogleCredentialWithAccessTokenProvider.fromAccessTokenProvider(
              Clock.SYSTEM, accessTokenProvider);
      // TODO: credential.createScoped does nothing at the moment, since
      //  GoogleCredentialWithAccessTokenProvider never sets the serviceAccountPrivateKey.
      //  The AccessTokenProvider interface does not provide a mechanism to return a private key,
      //  and scopes cannot be sent down to the AccessTokenProvider
      //  so they're essentially ignored at the moment.
      return credential.createScoped(scopes);
    }
docs: Creates a {@link Credential} based on information from the access token provider.