youtube has been renamed to youtubebroadcaster, and the new youtube has a new set of client keys.
Despite being named playlistId, the setting always contained the streamer's channel ID.
How it works
Toggle the youtubebroadcaster => 'sync_memberships' setting in your config.local.php to enable membership syncing. If disabled, no membership-related cron tasks will run and authing on /admin/youtube won't include the youtube.channel-memberships.creator scope. Remember that this scope requires special approval from Google.
After the streamer auths on /admin/youtube, we run the "full sync" task to fetch all available membership levels and all active members.
To fetch new members, we use a separate cron task that runs every five minutes. This task passes mode=updates as a parameter when pinging the /members endpoint, which means only new members since the last call will be returned.
Knowing the exact expiration date of a YouTube membership is difficult. To handle expirations easily, we simply run the "full sync" task every 24 hours to fetch all members again. We then compare this list of members to those in our database and prune the ones that no longer exist. This means memberships expire only once per day.
YouTube channel IDs are the only way to uniquely identify members, therefore, we need to know a user's channel ID to determine if they have an active membership. In the Subscription section of their profile page, users will now see a subsection titled YouTube with a button that reads Log in with YouTube. By clicking the button, users can auth with the youtube.readonly scope and let us fetch the IDs of their YouTube channels. These IDs are cross-referenced with the IDs of active members to check their membership status. Note that youtube.readonly is a "sensitive" scope, so users will be greeted with a very spooky warning if your app isn't verified.
Additional things
The database has been updated. Remember to run scripts/db/upgrade-2.25.0-15-11-2020.sql!
The recent videos widget on the homepage is now updated using authenticated requests. This means the streamer must auth on /admin/youtube for it to work.
Fixed a bug that completely broke authing with StreamElements.
Reduced log level for cron tasks.
Fix bug related to logging error messages in Discord.
This PR closes #222.
config.local.php
changesOld
New
youtube
has been renamed toyoutubebroadcaster
, and the newyoutube
has a new set of client keys.playlistId
, the setting always contained the streamer's channel ID.How it works
Toggle the
youtubebroadcaster => 'sync_memberships'
setting in yourconfig.local.php
to enable membership syncing. If disabled, no membership-related cron tasks will run and authing on/admin/youtube
won't include theyoutube.channel-memberships.creator
scope. Remember that this scope requires special approval from Google.After the streamer auths on
/admin/youtube
, we run the "full sync" task to fetch all available membership levels and all active members.To fetch new members, we use a separate cron task that runs every five minutes. This task passes
mode=updates
as a parameter when pinging the/members
endpoint, which means only new members since the last call will be returned.Knowing the exact expiration date of a YouTube membership is difficult. To handle expirations easily, we simply run the "full sync" task every 24 hours to fetch all members again. We then compare this list of members to those in our database and prune the ones that no longer exist. This means memberships expire only once per day.
YouTube channel IDs are the only way to uniquely identify members, therefore, we need to know a user's channel ID to determine if they have an active membership. In the
Subscription
section of their profile page, users will now see a subsection titledYouTube
with a button that readsLog in with YouTube
. By clicking the button, users can auth with theyoutube.readonly
scope and let us fetch the IDs of their YouTube channels. These IDs are cross-referenced with the IDs of active members to check their membership status. Note thatyoutube.readonly
is a "sensitive" scope, so users will be greeted with a very spooky warning if your app isn't verified.Additional things
scripts/db/upgrade-2.25.0-15-11-2020.sql
!/admin/youtube
for it to work.