thanks for the update. I actually did stumble upon this fix awhile back but forgot to post the answer here. Thx
const drive = google.drive({ version: "v3", auth });
let nextPageToken = null;
driveObject.members = [];
/// The permissions.list api behaves differently from other google drive apis (like drive.list) in that it will not
/// take a nextPageToken null param on the first call. It results in 'invalid token error'.
do {
/// SET permParams BASED ON nextPageToken value. WORK-AROUND TO LIMITATION IN permissions.list API (see above)///
if (nextPageToken == null) {
permParams = {
fileId: gdrive.id,
pageSize: 100,
supportsAllDrives: true,
fields: "nextPageToken, permissions(id,emailAddress,role,photoLink)",
useDomainAdminAccess: true
}
} else {
permParams = {
fileId: gdrive.id,
pageToken: nextPageToken,
pageSize: 100,
supportsAllDrives: true,
fields: "nextPageToken, permissions(id,emailAddress,role,photoLink)",
useDomainAdminAccess: true
}
}
const permissionList = await drive.permissions.list(permParams);
nextPageToken = permissionList.data.nextPageToken;