Yt::YouTubeOAuthClient
Client for handling YouTube OAuth 2.0 authentication flow.
This client manages the OAuth2 authorization process for accessing YouTube APIs, including generating authorization URLs, exchanging authorization codes for tokens, and refreshing expired tokens.
Example
client = YouTubeOAuthClient.new("client_id", "client_secret", "http://localhost:8080")
auth_url = client.get_authorize_uri("https://www.googleapis.com/auth/youtube")
token = client.get_access_token("authorization_code")
Constants
Constructors
Instance methods
Exchange authorization code for access and refresh tokens
authorization_code - The authorization code received from OAuth flow Returns OAuth2::AccessToken containing access_token and refresh_token Raises ValidationError if authorization_code is invalid Raises NetworkError on network failures Raises AuthenticationError if code is invalid or expired
Generate an OAuth2 authorization URL for the specified scope
scope - The OAuth2 scope string defining API access permissions Returns a String containing the authorization URL Raises ValidationError if scope is invalid
Refresh an expired access token using the refresh token
refresh_token - The refresh token obtained during initial authorization Returns OAuth2::AccessToken::Bearer with new access token Raises ValidationError if refresh_token is invalid Raises NetworkError on network failures Raises AuthenticationError if the refresh token is invalid or revoked