No permission to list channel members and next_page_token is invalid or expired when listing channel member and the channel's next page

Format Your New Topic as Follows:

API Endpoint(s) and/or Zoom API Event(s)

  1. list the user’s channel https://developers.zoom.us/docs/api/rest/reference/chat/methods/#operation/getChannels
    e.g. https://api.zoom.us/v2/chat/users/$USER_ID/channels?page_size=1
  2. list the channel members
    https://developers.zoom.us/docs/api/rest/reference/chat/methods/#operation/listChannelMembers
    e.g. https://api.zoom.us/v2/chat/users/$USER_ID/channels/$CHANNEL_ID/members
  3. list the user’s channel with next_page_token
    https://api.zoom.us/v2/chat/users/$USER_ID/channels?next_page_token=$NEXT_PAGE_TOKEN

Description
We are trying to parse all the channels and their members in each channel.
Steps:

  1. We list the user’s channel with page_size=1 first.
  2. Then listing the channel’s member with the user’s id and the channel’s id.
  3. After that, we come back to continue to list the user’s channel with the next_page_token parameter.

But somehow, sometimes we would get the error “No permission to access the channel members” in step 2. But the user is in the channel and we just got the channel id from the first call and immediately make a request to list the channel’s members.

Another error is from step 3. We retrieve the next page for listing the user’s channel with next_page_token. But the error said, “The next page token is invalid or expired”. It only took a few seconds between step 1 to step2. How can be the next_page_token invalid or expired?

Here is the curl I use

taylorchung@/Users/taylorchung$ date; curl --location --request GET "https://api.zoom.us/v2/chat/users/$USER_ID/channels?page_size=1" \
--header "Authorization: Bearer $ACCESS_TOKEN"
Wed Jun 28 15:07:47 CST 2023
{"total_records":26,"page_size":1,"next_page_token":"d0mgw0l68VcCELwfuMH3vU2ZFf4IAVgyg11","channels":[{"id":"04978f07406d4184acc4a92bdf7afa95","jid":"04978f07406d4184acc4a92bdf7afa95@conference.xmpp.zoom.us","name":"INC29931674 | 7088.CA | GLS | 2 labels have issues. GLS screen is a child label attached but we don't see it. Trailer planning screen shows the buddy pallet issue","type":5,"channel_settings":{"new_members_can_see_previous_messages_files":true,"allow_to_add_external_users":1,"posting_permissions":1,"add_member_permissions":1,"mention_all_permissions":1},"channel_url":"https://walmart.zoom.us/launch/chat/v2/eyJzaWQiOiIwNDk3OGYwNzQwNmQ0MTg0YWNjNGE5MmJkZjdhZmE5NUBjb25mZXJlbmNlLnhtcHAuem9vbS51cyJ9"}]}%
taylorchung@/Users/taylorchung$ date; curl --location --request GET "https://api.zoom.us/v2/chat/users/$USER_ID/channels/04978f07406d4184acc4a92bdf7afa95/members" \
--header "Authorization: Bearer $ACCESS_TOKEN"
Wed Jun 28 15:07:55 CST 2023
{"code":200,"message":"No permission to access the channel members."}%
taylorchung@/Users/taylorchung$ date; curl --location --request GET "https://api.zoom.us/v2/chat/users/$USER_ID/channels?next_page_token=d0mgw0l68VcCELwfuMH3vU2ZFf4IAVgyg11" \
--header "Authorization: Bearer $ACCESS_TOKEN"
Wed Jun 28 15:08:21 CST 2023
{"code":300,"message":"The next page token is invalid or expired."}%
taylorchung@/Users/taylorchung$

Our app is account-level and uses Oauth to do authentication.

Error?

  1. No permission to access the channel members.
  2. The next page token is invalid or expired.

How To Reproduce
Steps to reproduce the behavior:

  1. List the user’s channel
  2. List the channel’s member with the user id and channel id from step 1
  3. For some channels, the error occurs.