Files
web-hosts/chuckie.coppertone.tech/app/docs/youtube-scopes.html
2025-12-26 13:38:04 +01:00

598 lines
20 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>YouTube API Scopes - Complete Reference</title>
<style>
body {
font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
max-width: 1400px;
margin: 0 auto;
padding: 20px;
background-color: #f9f9f9;
}
header {
background: linear-gradient(135deg, #FF0000, #CC0000);
color: white;
padding: 30px;
border-radius: 8px;
margin-bottom: 30px;
text-align: center;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
h1, h2, h3 {
color: #FF0000;
}
h1 {
font-size: 2.5em;
margin-bottom: 10px;
}
h2 {
font-size: 1.8em;
margin-top: 30px;
margin-bottom: 15px;
border-bottom: 3px solid #FF0000;
padding-bottom: 10px;
}
h3 {
font-size: 1.4em;
margin-top: 25px;
margin-bottom: 10px;
color: #666;
}
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
background-color: white;
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #FF0000;
color: white;
font-weight: 600;
}
tr:hover {
background-color: #f5f5f5;
}
.code-block {
background-color: #f5f5f5;
border: 1px solid #ddd;
border-radius: 4px;
padding: 15px;
overflow-x: auto;
font-family: 'Courier New', Courier, monospace;
font-size: 0.9em;
margin: 15px 0;
white-space: pre;
}
.scope-box {
background-color: #fff;
border: 2px solid #FF0000;
border-radius: 6px;
padding: 15px;
margin: 15px 0;
font-family: 'Courier New', Courier, monospace;
font-size: 0.9em;
overflow-x: auto;
}
.note {
background-color: #e7f3ff;
border-left: 4px solid #2196F3;
padding: 15px;
margin: 20px 0;
border-radius: 4px;
}
.warning {
background-color: #fff3e7;
border-left: 4px solid #ff9800;
padding: 15px;
margin: 20px 0;
border-radius: 4px;
}
.success {
background-color: #e8f5e9;
border-left: 4px solid #4CAF50;
padding: 15px;
margin: 20px 0;
border-radius: 4px;
}
ul, ol {
margin: 15px 0;
padding-left: 30px;
}
li {
margin-bottom: 8px;
}
a {
color: #FF0000;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.toc {
background-color: #f0f2f5;
padding: 20px;
border-radius: 8px;
margin-bottom: 30px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.toc h3 {
color: #FF0000;
margin-top: 0;
}
.toc ul {
padding-left: 20px;
}
.checkmark {
color: #4CAF50;
font-weight: bold;
}
.crossmark {
color: #F44336;
font-weight: bold;
}
footer {
margin-top: 50px;
padding-top: 20px;
border-top: 2px solid #FF0000;
text-align: center;
color: #666;
font-size: 0.9em;
}
.resource-link {
display: inline-block;
margin: 5px;
padding: 8px 15px;
background-color: #FF0000;
color: white;
border-radius: 4px;
text-decoration: none;
transition: background-color 0.3s;
}
.resource-link:hover {
background-color: #CC0000;
}
</style>
</head>
<body>
<header>
<h1>YouTube API Scopes - Complete Reference</h1>
<p>Comprehensive list of all YouTube API OAuth 2.0 scopes with usage guidelines</p>
</header>
<div class="toc">
<h3>Table of Contents</h3>
<ul>
<li><a href="#data-api-scopes">YouTube Data API v3 Scopes</a></li>
<li><a href="#analytics-scopes">YouTube Analytics API Scopes</a></li>
<li><a href="#reporting-scopes">YouTube Reporting API Scopes</a></li>
<li><a href="#live-scopes">YouTube Live Streaming API Scopes</a></li>
<li><a href="#usage-guidelines">Scope Usage Guidelines</a></li>
<li><a href="#best-practices">Best Practices</a></li>
<li><a href="#complete-reference">Complete Scope Reference</a></li>
<li><a href="#comparison">Scope Comparison Table</a></li>
</ul>
</div>
<section id="data-api-scopes">
<h2>YouTube Data API v3 Scopes</h2>
<h3>Basic Scopes</h3>
<table>
<thead>
<tr>
<th>Scope</th>
<th>Description</th>
<th>Access Level</th>
</tr>
</thead>
<tbody>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/youtube</td>
<td>Manage your YouTube account - full read/write access</td>
<td>Full access</td>
</tr>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/youtube.readonly</td>
<td>View your YouTube account - read-only access</td>
<td>Read-only</td>
</tr>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/youtube.upload</td>
<td>Upload YouTube videos - upload-only access</td>
<td>Upload only</td>
</tr>
</tbody>
</table>
<h3>Channel-Specific Scopes</h3>
<table>
<thead>
<tr>
<th>Scope</th>
<th>Description</th>
<th>Access Level</th>
</tr>
</thead>
<tbody>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/youtube.channel-memberships.creator</td>
<td>Manage YouTube channel memberships</td>
<td>Creator access</td>
</tr>
</tbody>
</table>
<h3>Partner Scopes</h3>
<table>
<thead>
<tr>
<th>Scope</th>
<th>Description</th>
<th>Access Level</th>
</tr>
</thead>
<tbody>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/youtubepartner</td>
<td>View and manage your assets and associated content on YouTube</td>
<td>Partner access</td>
</tr>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/youtubepartner-channel-audit</td>
<td>View private information of your YouTube content</td>
<td>Audit access</td>
</tr>
</tbody>
</table>
</section>
<section id="analytics-scopes">
<h2>YouTube Analytics API Scopes</h2>
<table>
<thead>
<tr>
<th>Scope</th>
<th>Description</th>
<th>Access Level</th>
</tr>
</thead>
<tbody>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/yt-analytics.readonly</td>
<td>View YouTube Analytics reports for your YouTube content</td>
<td>Read-only</td>
</tr>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/yt-analytics-monetary.readonly</td>
<td>View monetary reports for your YouTube content</td>
<td>Financial read-only</td>
</tr>
</tbody>
</table>
</section>
<section id="reporting-scopes">
<h2>YouTube Reporting API Scopes</h2>
<table>
<thead>
<tr>
<th>Scope</th>
<th>Description</th>
<th>Access Level</th>
</tr>
</thead>
<tbody>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/youtube.readonly</td>
<td>View YouTube reporting data</td>
<td>Read-only</td>
</tr>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/yt-analytics.readonly</td>
<td>View YouTube Analytics reports</td>
<td>Read-only</td>
</tr>
</tbody>
</table>
</section>
<section id="live-scopes">
<h2>YouTube Live Streaming API Scopes</h2>
<table>
<thead>
<tr>
<th>Scope</th>
<th>Description</th>
<th>Access Level</th>
</tr>
</thead>
<tbody>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/youtube</td>
<td>Manage YouTube live streams</td>
<td>Full access</td>
</tr>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/youtube.readonly</td>
<td>View YouTube live stream information</td>
<td>Read-only</td>
</tr>
<tr>
<td class="scope-box">https://www.googleapis.com/auth/youtube.upload</td>
<td>Upload YouTube live stream content</td>
<td>Upload access</td>
</tr>
</tbody>
</table>
</section>
<section id="usage-guidelines">
<h2>Scope Usage Guidelines</h2>
<h3>Choosing the Right Scope</h3>
<div class="success">
<strong>Principle of Least Privilege:</strong> Always request the minimum scope required for your application
</div>
<ul>
<li><strong>User Experience:</strong> Fewer scopes = better user adoption</li>
<li><strong>Security:</strong> More restrictive scopes reduce potential security risks</li>
<li><strong>App Review:</strong> Some scopes require additional verification</li>
</ul>
<h3>Common Scope Combinations</h3>
<h4>Basic Video Upload</h4>
<div class="scope-box">https://www.googleapis.com/auth/youtube.upload</div>
<h4>Channel Management</h4>
<div class="scope-box">https://www.googleapis.com/auth/youtube</div>
<h4>Analytics Dashboard</h4>
<div class="scope-box">https://www.googleapis.com/auth/yt-analytics.readonly
https://www.googleapis.com/auth/youtube.readonly</div>
<h4>Content Creator App</h4>
<div class="scope-box">https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtubepartner</div>
</section>
<section id="best-practices">
<h2>Best Practices</h2>
<h3>Scope Request Best Practices</h3>
<ol>
<li><strong>Incremental Authorization:</strong> Request additional scopes as needed rather than all at once</li>
<li><strong>Scope Explanation:</strong> Provide clear explanations to users about why each scope is needed</li>
<li><strong>Error Handling:</strong> Handle scope-related errors gracefully</li>
<li><strong>Token Management:</strong> Store and refresh tokens securely</li>
</ol>
<h3>Security Considerations</h3>
<div class="warning">
<strong>Security Warning:</strong> Never hardcode scopes in client-side code. Use server-side authentication for sensitive operations.
</div>
<ul>
<li>Regularly review the scopes your application uses</li>
<li>Monitor for scope changes in API updates</li>
<li>Implement proper token storage and rotation</li>
<li>Use HTTPS for all API communications</li>
</ul>
<h3>Example OAuth 2.0 Flow with Scopes</h3>
<div class="code-block">
// Node.js example using Google API Client Library
const {google} = require('googleapis');
const youtube = google.youtube('v3');
// Configure OAuth2 client
const oauth2Client = new google.auth.OAuth2(
'YOUR_CLIENT_ID',
'YOUR_CLIENT_SECRET',
'YOUR_REDIRECT_URL'
);
// Generate auth URL with specific scopes
const scopes = [
'https://www.googleapis.com/auth/youtube.upload',
'https://www.googleapis.com/auth/youtube.readonly'
];
const url = oauth2Client.generateAuthUrl({
access_type: 'offline',
scope: scopes
});
console.log('Authorize this app by visiting:', url);
</div>
</section>
<section id="complete-reference">
<h2>Complete Scope Reference</h2>
<h3>All YouTube API Scopes</h3>
<h4>Basic YouTube Data API</h4>
<div class="scope-box">
https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtube.readonly
https://www.googleapis.com/auth/youtube.upload
</div>
<h4>YouTube Partner Scopes</h4>
<div class="scope-box">
https://www.googleapis.com/auth/youtubepartner
https://www.googleapis.com/auth/youtubepartner-channel-audit
</div>
<h4>YouTube Analytics</h4>
<div class="scope-box">
https://www.googleapis.com/auth/yt-analytics.readonly
https://www.googleapis.com/auth/yt-analytics-monetary.readonly
</div>
<h4>YouTube Channel Memberships</h4>
<div class="scope-box">
https://www.googleapis.com/auth/youtube.channel-memberships.creator
</div>
</section>
<section id="comparison">
<h2>Scope Comparison Table</h2>
<table>
<thead>
<tr>
<th>Scope</th>
<th>Read</th>
<th>Write</th>
<th>Upload</th>
<th>Analytics</th>
<th>Partner</th>
<th>Memberships</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>youtube</code></td>
<td class="checkmark"></td>
<td class="checkmark"></td>
<td class="checkmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
</tr>
<tr>
<td><code>youtube.readonly</code></td>
<td class="checkmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
</tr>
<tr>
<td><code>youtube.upload</code></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
<td class="checkmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
</tr>
<tr>
<td><code>youtubepartner</code></td>
<td class="checkmark"></td>
<td class="checkmark"></td>
<td class="checkmark"></td>
<td class="crossmark"></td>
<td class="checkmark"></td>
<td class="crossmark"></td>
</tr>
<tr>
<td><code>yt-analytics.readonly</code></td>
<td class="checkmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
<td class="checkmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
</tr>
<tr>
<td><code>youtube.channel-memberships.creator</code></td>
<td class="checkmark"></td>
<td class="checkmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
<td class="crossmark"></td>
<td class="checkmark"></td>
</tr>
</tbody>
</table>
</section>
<section id="resources">
<h2>Additional Resources</h2>
<div style="text-align: center; margin: 20px 0;">
<a href="https://developers.google.com/youtube/v3" class="resource-link" target="_blank">Official YouTube API Documentation</a>
<a href="https://developers.google.com/identity/protocols/oauth2" class="resource-link" target="_blank">Google OAuth 2.0 Documentation</a>
<a href="https://developers.google.com/youtube/v3/guides/authentication" class="resource-link" target="_blank">YouTube API Scope Reference</a>
<a href="https://developers.google.com/api-client-library" class="resource-link" target="_blank">Google API Client Libraries</a>
</div>
</section>
<section id="troubleshooting">
<h2>Troubleshooting</h2>
<h3>Common Scope-Related Issues</h3>
<ol>
<li><strong>Insufficient Permissions:</strong> Ensure you're requesting the correct scope for the operation</li>
<li><strong>Scope Mismatch:</strong> Verify the token was obtained with the required scopes</li>
<li><strong>Expired Tokens:</strong> Implement token refresh logic</li>
<li><strong>User Denied Scopes:</strong> Handle authorization failures gracefully</li>
</ol>
<h3>Debugging Tips</h3>
<ul>
<li>Use the <a href="https://developers.google.com/oauthplayground/" target="_blank">Google OAuth 2.0 Playground</a> to test scopes</li>
<li>Check token information using the <a href="https://www.googleapis.com/oauth2/v3/tokeninfo" target="_blank">Google Token Info endpoint</a></li>
<li>Review the <a href="https://developers.google.com/youtube/v3/docs/error-code-reference" target="_blank">YouTube API Error Reference</a></li>
</ul>
<div class="note">
<strong>Note:</strong> Always refer to the official YouTube API documentation for the most up-to-date information and scope changes.
</div>
</section>
<footer>
<p>This comprehensive list covers all available YouTube API scopes with detailed explanations of their purposes and usage guidelines.</p>
<p>Last updated: <span id="last-updated"></span></p>
<script>
// Set last updated date
document.getElementById('last-updated').textContent = new Date().toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
</script>
</footer>
</body>
</html>